Sunday, 1 July 2012

Football, football, chimpanzee-riding-a-segway, football

I have finished my challenge! With ten minutes remaining until I go to the pub, I have typed the last of my 200~ lines of code... I don't have time to upload it, but tomorrow I will be uploading a GIF of the game in action. Come on Italy!

Update:

Admittedly this IS rather later than planned, but it turns out I was being pretty optimistic when I said I was 'finished'. Fifty-additional-lines-of-code optimistic; including a timer, a visual output and a complete re-haul of what I am naively calling my 'engine'. Note: the ball is the black dot that spends most of the game flashing into and out of existence, and when it is in existence thinking "Oh, this patch of grass again".


I apologise for the points where the entire board goes blank, that is when the moment that the screen recorder takes an image syncs up with when I clear the board before placing the ants at their next position. As you see in the message box at the end the game was a nil-nil draw, and that was with 51 players on each side. Clearly there is no need to replace Manchester United with giant robotic ants. Yet.

My game has some simplified rules:

  1. Players start randomly positioned around their own half.
  2. The goalies are only only allowed to move up and down their goal line (orange).
  3. When a player runs into the ball it is kicked in a straight line of length ranging between 10 and 30 cells. The ball stops if it hits another player.
  4. If the ball goes out the sides it is randomly positioned on a line parallel to the halfway line.
  5. If the ball goes out the ends it returns to the centre (a weak simulation of a goalkick).

For interested parties, here is the entire spreadsheet of my project. For the football program go to the "Football" sheet, then CTRL+E to bring up the menu and type in "football".

Technical details:
The way I have written this program is such that it processes the entire game before putting up the display. The benefits of this are a smoother visualisation and the ability to remove the 'trail' of the ant making the visual output much clearer. This means I am now not storing the locations of my ants in excel cells, but in 2 three dimensional arrays (three because I reference by player number, by team number and by turn). This is much more memory heavy, but gives the benefits listed above.

2101,

mathmo

Easter Egg 1: A chimpanzee riding a Segway.

Easter Egg 2: In the spreadsheet go to the sheet called "Game", CTRL+E to bring up the menu and type in "game2". Be amazed. WARNING: This uses my old style of processing so will take a while.

No comments:

Post a Comment

About Me

I am a mathmo (mathematician for anyone not familiar with Cambridge slang) studying at the University of Cambridge, and this is the blog of my summer project on Langton's Ant. This project was dreamt up one evening in the college bar when I was showing some of the compscis (computer scientists) my old visual basic excel macros and stumbled across a very basic Langton's Ant. What I showed them was just one boring black ant. By the time I left the bar that morning I had progressed to two coloured ants colliding with each other, the demo macro that most of this project is built from. Through this project I hope to expand my knowledge of visual basic, encourage others to mess around with maths on their computers, and to make a lot of pretty pictures. I will aim to keep my language fairly non-technical, but feel free to comment if you have a question or even a suggestion on how to improve my code. Here it goes...