Thursday 4 September 2014

247 - Game of Cat and Mouse

Day 247. Flying from Sydney to Singapore today, those hours in the air are always good times to spend learning and exploring new ideas. Today I built this little experiment in Scratch. Basically the mouse moves based on a random algorithm, and the cat tries to chase it. When it catches the mouse, the score increases by one and the time is noted, and tracked to record the longest time between catches. The times are then dumped into a data array list and collected. The cat and mouse move to a new random start point and start again.



What I found interesting was that if you run the simulation for a while, (70 cycles in the example below) and then export the data out of the array, you can open it in a spreadsheet and graph it. When I did that and sorted the times from smallest to largest, the regularity of the curve was striking. As random as we think things might be, the scope of that "randomness" is fairly  predictable. There are no real gaping holes in the times.

The other interesting thing is that, while sketching and drawing are usually seen as the outlets for creativity, the amount of creative problem solving, trial and error and "what if" brainstorming that I do when I'm programming like this is far more intense.


No comments:

Post a Comment