In this version a drunk is asked to leave the establishment he was imbibing in. Once on the sidewalk the door closes behind him and he can walk either towards the street or back towards the door, randomly choosing a direction before he takes each step. If he bumps into the door he turns around, if he reaches the curb he falls into the street ending his walk.
Will he ever reach the street? How long will it take? What will his path look like?
In his book Full House Stephen Jay Gould uses this example to illustrate his argument that lifes seeming directed movement torwards higher and higher complexty can be explained entirely as random motion.
Once the basic project was written I wanted a way to plot the turtles movement, to draw a graph of its movements. How can we do this? The traditional way is to create a data structure, an array most likely, with each element of the array corresponding to one spot on the path. We record the number of times the turtle lands at a particular spot in the arrray. Once the walk is finished we can take this data and plot the turtles movements. One drawback to this approach is that the data structure can get hard to handle and in MicroWorlds there is no 'array' data type so we would have to implement our own out of lists. Possible but not easy.
Another approach is to use MicroWorlds multi-turtle capabilites.
This project uses the multiple turtle routines I introduced in the Circles project.