Advanced Programming Techniques – Semester 2, 2018 Assignment Two (v1.0, 3 Sept 2018)
A S S I G N M E N T T W O : G E N E T I C A L G O R I T H M
A D VA N C E D P R O G R A M M I N G T E C H N I Q U E S – S E M E S T E R 2 , 2 0 1 8
In this assignment, you will use your C programming skills to build a simple Genetic Algorithm.
A genetic algorithm (GA) is a heuristic search technique inspired by natural selection. A
population of candidate solutions to a problem is iteratively evolved towards an optimal
solution (as measured by an evaluation function) by:
? Evaluating the ‘fitness’ of candidate solutions according to the evaluation function
? Probabilistically selecting ‘fitter’ candidate solutions from the population to act as
‘parents’ for the next generation of candidate solutions
? Introducing constrained novelty to the new generation via operations analogous to
reproduction and mutation. (Note: the selection function will then tend to remove ‘bad’
The course Canvas assignment 2 page has links to descriptions of the above operations.
Genetic algorithms are used in computing and industry in areas as diverse as hardware design
optimization, scheduling and machine learning. The genetic algorithm of this assignment is
applied to two problems:
minfn: determine variables to satisfy an equation
pcbmill: minimise the drill head movement (and thus the time taken to drill) of a mill
for drilling holes in a Printed Circuit Board (PCB).
The course Canvas assignment 2 page has links to specifications for minfn and pcbmill and
sample data files that they can use.
In the following sections of this document, the details of your assignment are explained. Read
them thoroughly and ask your questions from the teaching team. You are expected to
understand every requirement explained in this document and implement all of them
Semester 2, 2018
Due Friday 21st September, 2018, 20:30
This assignment follows a programming pattern called MVC (the Model, View,
Controller) pattern. You have been provided with the view and controller classes
but you will be required to implement several modelling classes.
The modelling classes are from the popular card game, Uno. Each class you’re
required to implement has a specification that is outlined in this document. A
specification is a description of each method in a class as well as their parameters
and return values.
Once you have implemented the modelling classes, you will have completed a
digital version of Uno that follows the MVC pattern.
Uno is a card based game consisting primarily of cards with both a colour and a
number. Each player starts with a deck of seven cards. The player whose cards are
visible is the starting player. Once the player makes a move by selecting their card
to play, their cards will be hidden and it will move to the next players turn.
There are two piles in the middle of the board. The left pile is the pickup pile, a
player should click this pile if they have no cards to play, it will add a card to their
deck. The right pile is the putdown pile, a player has to pick a card from their deck
which matches the card on top of the putdown pile.
The aim of the game is to have no cards left in your deck. Each turn a player can
either select a card from their pile which matches the card on top of the putdown
pile, or, they can pickup a new card from the pickup pile if they have no matching
a2.py – file where you write your submission
a2_support.py – contains supporting code and part of the controller
gui.py – contains the view
player.txt – a list of random player names to use for computer players
images/ – a directory of card images