This page was automatically generated by NetLogo 3.1.3. Questions, problems? Contact

The applet requires Java 1.4.1 or higher. It will not run on Windows 95 or Mac OS 8 or 9. Mac users must have OS X 10.2.6 or higher and use a browser that supports Java 1.4. (Safari works, IE does not. Mac OS X comes with Safari. Open Safari and set it as your default web browser under Safari/Preferences/General.) On other operating systems, you may obtain the latest Java plugin from Sun's Java site.

In order for this to work, this file, your model file (road block.nlogo), and the file NetLogoLite.jar must all be in the same directory. (You can copy NetLogoLite.jar from the directory where you installed NetLogo.)

On some systems, you can test the applet locally on your computer before uploading it to a web server. It doesn't work on all systems, though, so if it doesn't work from your hard drive, please try uploading it to a web server.

You don't need to include everything in this file in your page. If you want, you can just take the HTML code beginning with <applet> and ending with </applet>, and paste it into any HTML file you want. It's even OK to put multiple <applet> tags on a single page.

If NetLogoLite.jar and your model are in different directories, you must modify the archive= and value= lines in the HTML code to point to their actual locations. (For example, if you have multiple applets in different directories on the same web server, you may want to put a single copy of NetLogoLite.jar in one central place and change the archive= lines of all the HTML files to point to that one central copy. This will save disk space for you and download time for your user.)

created with NetLogo

view/download model file: road block.nlogo


This program paints a certain percentage of patches yellow, and then sends a turtle through the grid to count the number of yellow patches. a large brown square is generated at a location in the grid specified by the user that the turtle must navigate around. the turtle uses its senses and memory to evaluate the world that it is in to count the total number of patches it has passed, remember the number of yellow patches it has seen and measure the size of the grid. It also uses a sense of purpose (its knowledge of the column that it's supposed to be on) to overcome obstacles (the brown square).


set-up: goes through the patches, forms a large brown square around a relative point specified by the user and for each remaining patch generates a random number between 1 and 100. if that number is less than the given percentage it paints the patch yellow. the turtle is set to be alive at the bottom left with a counter of zero.

go: if the turtle is alive,

it looks to see if it is on a yellow square.
if it is: it increases its counter
and reports it to the global counter

it looks at its position.
if it's below the brown square it goes around it

else if it's at the top of a line, it starts the next line
if it's at the top right, it sets its life variable to dead
if it's neither, it just goes up one

go around
if the turtle goes right until the end of the square
then goes up the side of the square
then returns to the column, which it was at


adjust the slider to the desired % of yellow squares
hit set-up to set-up
"actual number" is a tally used in painting the patches yellow that gives the right number of yellow patches
"# seen" keeps track of how many yellow patches the turtle has seen
"# visited" keeps track of the total number of patches that the turtle has been on
"guess" divides the above to variables to guess at the percentage of yellow squares (which the user specifies)
"col. size" counts the number of patches in the first column so that the turtle can calculate how large the arena is
"estimated #" multiplies percantage by column size squared (minus 64 for the brown square)

hit go to go


rob korobkin hc '08
march 26, 2006