When | Mood | Music |
2012-04-11 18:40:00 | content | Space Shanty – Leftfield |
I now have code for a grid-square class. Grid-square objects
- know where they are
- how many ogres, donkeys, parrots and snakes they contain (initially zero of each)
- can increment and decrement the numbers of these creatures (and will sing out if the numbers ever become negative or if there is more than 1 ogre)
- can report these numbers
- can decide whether the ogre overwhelms the other creatures or vice versa (and will sing out if I try to have a battle involving zero ogres)
Now I have to construct a row as a collection of grid-squares and create methods to
- add an ogre to a random square
- add donkeys, parrots and snakes at random to the first square in the grid
- move the denizens about at random
- provoke fights between the ogre and the others in whatever grid-square he’s in.
Then I have to construct a swamp as a collection of rows and develop 2-D versions of the random-movement methods.
Poor ogre – no matter what, eventually he’s going to be brayed, squawked or venomed (or combinations thereof) out of existence.