Today everyone at the University of Hull got their results for semester 1 of this year, including myself.
Semester 1 this year was almost certainly the most challenging semester I have taken so far at university, as you might expect. This increase in difficulty meant I had to put in even more effort and be even more determined than in previous years — therefore I was both pleasantly surprised, and extremely happy with my results — 90% for “Data Mining and Decision Systems” and 83% for “Languages and Their Compilers”.
These grades, combined with my grades from last year, put me in a very good position to get a first class degree, which of course I’m very happy about.
I will of course keep the blog updated over the rest of this final year.
Last night my housemate Hayley and I were talking about the Data Mining and Decision Systems module we took last semester, during that discussion the concept of genetic algorithms came up.
In the computer science field of artificial intelligence, a genetic algorithm (GA) is a search heuristic that mimics the process of natural selection, except that GAs use a goal-oriented targeted search and natural selection isn’t a search at all
Hayley explained the concept to me using the idea of an animal that is more likely to survive in its environment by blending in with the colour of its surroundings. So tonight, as a nice change from revision and work on my Final Year Project, I had a go at developing such an algorithm — with a somewhat humorous undertone. The result of this undertaking is a little tech demo called “The Generation Game – A Simple Genetic Algorithm”.
In the demo it is advantageous for a sheep to be green, in order to fit in with its field. However at the beginning of the game the ten sheep in the initial flock are of completely random colours.
Turns are taken, in order by
- A Flock of Sheep, which breeds, producing 1 new sheep for every two sheep in the flock (if there is a left over sheep it doesn’t breed). Sheep produced by the mating process are the median colour of its two parents.
- A Wolfpack which depending on its hunting ability can eat 10% – 60% of the heard in any given turn
The closer a sheep is to the colour green, the less likely it is the be a casualty of a wolf attack (however there are other contributing factors, and a green sheep can still be killed).
As you can see from the gif image above if the initial flock has a green sheep amongst its ranks then evolution takes place (survival of the fittest, like how Darwin described it) and within just 20 generations the flock consists of only green sheep.
Another interesting situation is when there is no green sheep in the initial flock.
As you can see from the example above which starts with no green sheep the flock gradually becomes a light brown colour, this is the closest colour the flock could get to green with the genes avaliable in its gene pool.
This is just a simple tech demo (written in C# with XNA) to prove to myself I understood the concept, but it worked out quite well and I think its cool. I’ll be cleaning up the code and adding some comments, so be sure to check out the repository containing the program on GitHub.
Thats all for now,