|2012-04-13 18:44:00||amused||Who Needs Information – Roger Waters|
The music was unintentional but is amusingly appropriate.
I can add a lot of creatures, move them all around and draw a textual ‘map’ of where they all are. Even better, it agrees with where the creatures themselves say they are!
- List of creatures and their individuate coordinates 1
- Independently-generated map 1
- List of creatures and their individuate coordinates 2
- Independently-generated map 2
The code to draw the map is horribly inefficient: for each grid-square in each row, each creature is asked ‘should you be added to the list of creatures for this grid-square?’. For a 4 by 4 swamp, each creature is interrogated mercilessly 16 times! I hope I can find a better way – maybe each creature could have a record of whether it’s been added to the map. But then it would need to be interrogated about this too!
If I was still working with grid-square objects, the code would have been ‘for each grid-square in each row, ‘give me a list of your contents’. But that approach didn’t work because of the difficulty of moving creatures.