- I apologise for the cliché.
- I apologise for the cliché of starting a post with a cliché.
- I apologise for the cliché of apologising for using a cliché.
Now that I have finished cliché-ing my clichéd cliché's, let's move on to the news.
The bad news is that I have no pretty pictures (note the alliteration, I really am trying arts students) for you today as my computer has overheated. Or in other words my laptop has decided that what it would really really like to do instead of running my program is to raise the mean temperature of the local area by a couple degrees then take a half hour siesta. And by local area I mean Scotland. The good news is that I have written the program that should have produced said pictures, and I will be updating this post tomorrow assuming that the heat has dissipated sufficiently. I suggest you read "dissipated sufficiently" as melted the polar ice caps.
If you can read between the lines or italics, I have been a little antagonized by my laptop this evening. I think part of my problem is also that my code is extremely inefficient, mostly down to the constraints of using excel cells, something which I am going to need to deal with as this project progresses.
Here is a brief summary of the code my computer tried and failed to run:
Multiple ants are contained within a nxn square which has a boundary which the ants bounce off of. When one ant lands on another, the second ant "kills" the first. The game runs until only one ant is left alive.It looks simple enough, but it quickly becomes clear that this is a game that will last a LONG time. Imagine you have only two ants on a 10x10 board. Suppose the ants are randomly placed each turn (uniformly for the probability nerds), then the probability of one ant killing the other on any one turn is 1/100. It is fair to say that the odds are actually worse than this, as the position of the ant at every turn is determined once the ant is placed on the grid and these positions are likely to be fairly far away from the other ant on most turns. But suppose it is 1/100. Then if we scale to a 100x100 board (tiny on spreadsheet sizes) the odds are 1/10000. If we then introduce another ant being randomly distributed around the board the odds go up to 1/3333. Now suppose we use the entire spreadsheet and all 54 ants. Then we have odds of 1/6002750 that an ant will be killed on any one turn. And that is just the first ant. All in, the odds of there being a winner is approximately 1/10^426. For a sense of scale, excel returns that number as zero. 10^426 is 25 orders of magnitude larger than the age of the universe in seconds, or 5 orders of magnitude larger than the number of protons in the observable universe.
I have been extremely vague in my probabilities, but I think you get the picture. This game was an interesting diversion, but I will need to adapt it to actually make it completable. So far my best idea to correct this has been some form of area kills. However I am going to put this on hold for a new game. Ladies and gentleman I am going to issue myself with a challenge; to design and create a football game involving Langton's Ant by the full time whistle of the Euro 2012 Final.
781,
mathmo
Update:
I managed to run my code tonight, and it turns out that it wasn't so much my laptop overheating as that I had inadvertently included an infinite loop. "Sorry laptop, I will take you out for a byte to eat to make up for it."
I had to alter the game quite a lot to make it finish-able, but even then I had to limit it to running each ant 100,000 times then declare all surviving ants as winners. I have also managed to solve my previous issue of limited space by making the black border transport ants to the order side of the board. This can be most easily seen in the Cyan ant, where its expansion is divided by the border but is still continuous. You can also see that the Cyan ant has eliminated the Light Green ant fairly quickly. Other highlights include the epic battle between Maroon and Pink, and the swashbuckling adventures of Dark Blue, who seemed to be duelling 6 opposing ants at once. Pink wins the award for being the only ant to reach all four sides.
I think I can do more with this game, such as making it team battles and giving each ant lives and a special ability (for example extra speed or area attack), but I am putting it aside for now to focus on my challenge.
Interesting factoid: One of the errors that cropped up during coding was that I had forgotten to move the 'corpses' of the dead ants off the board. This resulted in ants claiming multiple kills for in essence what was them jumping up and down on a dead body. Who said programming wasn't gory?
Update:
I managed to run my code tonight, and it turns out that it wasn't so much my laptop overheating as that I had inadvertently included an infinite loop. "Sorry laptop, I will take you out for a byte to eat to make up for it."
The Game |
I think I can do more with this game, such as making it team battles and giving each ant lives and a special ability (for example extra speed or area attack), but I am putting it aside for now to focus on my challenge.
Interesting factoid: One of the errors that cropped up during coding was that I had forgotten to move the 'corpses' of the dead ants off the board. This resulted in ants claiming multiple kills for in essence what was them jumping up and down on a dead body. Who said programming wasn't gory?
No comments:
Post a Comment