NetLogo banner

 Home
 Download
 Help
 Resources
 Extensions
 FAQ
 References
 Contact Us
 Donate

 Models:
 Library
 Community
 Modeling Commons

 User Manuals:
 Web
 Printable
 Chinese
 Czech
 Japanese
 Spanish

  Donate

NetLogo Models Library:
Sample Models/Mathematics/Probability/Unverified

Note: This model is unverified. It has not yet been tested and polished as thoroughly as our other models.

(back to the library)

Random Walk Left Right

[screen shot]

If you download the NetLogo application, this model is included. (You can also run this model in your browser, but we don't recommend it; details here.)

WHAT IS IT?

This is a model to simulate a random walk. In this simulation, all turtles walk to the left and forward or they walk to the right and forward. The turtles randomly choose between either direction each time they move.

The path traced out by the turtles moving in this pattern is called a lattice.

HOW IT WORKS

As the simulation continues, one can expect the turtles to become more spread out. Observe the kinds of patterns that develop as the turtles move.

Shading of turtles is representative of how many turtles share that location. Dark shades imply more turtles. Light shades imply fewer turtles.

For purposes of this simulation, "forward" will mean moving toward the top of the view, "left" will mean moving toward the left edge of the view, and "right" will mean moving toward the right edge of the view.

HOW TO USE IT

Use the NUMBER-OF-TURTLES slider to select how many turtles will participate in the random walk.

Use the NUMBER-OF-STEPS slider to decide how many steps a turtle will take on each turn.

How steps are implemented: - If NUMBER-OF-STEPS is set to 1 and a turtle is going left, it will go left one step and then go forward one step. (Imagine a turtle walking along the bottom and left edge of a 1 x 1 square.) - If NUMBER-OF-STEPS is set to 4 and a turtle is going left, it will go left four steps and then go forward four steps. (Imagine a turtle walking along the bottom and left edge of a 4 x 4 square.) - Each of the above movements would be considered a single "pace."

Use the TURTLE-TRAILS? switch to have the turtles put their pens down to trace their paths and show the part of the lattice they are covering. This switch must be set before the SETUP button is pressed.

All sliders except NUMBER-OF-TURTLES may be changed during a simulation.

Press the SETUP when all of the above selections have been made. This will create the selected number of turtles at the bottom center of the world.

Press GO ONCE button to make the turtles move one pace.

Press the GO button to make the turtles move until one of the turtles cannot complete its number of steps. When one turtle reaches this point, all the other turtles will stop even if they can complete the step.

To stop the simulation while it is running, press the GO button again.

The gray bar in the middle of the world is at xcor = 0. This is where all the turtles start.

THINGS TO TRY

Try to answer the questions below before running the simulations.

Record your predictions. Compare your predicted results with the actual results. - What reasoning led you to correct predictions? - What assumptions that you made need to be revised?

Try different numbers of turtles while keeping all other slider values the same.

Try different numbers of steps while keeping all other slider values the same.

THINGS TO NOTICE

Think about how you would define an "average" turtle and an "average" walk.

Where would you expect an average turtle to end up at the end of the simulation? Why?

How many paces would you expect there to be in an average walk? Why?

What kinds of calculations or measurements would you use in trying to answer these questions?

How do your answers to the above questions compare to the average of the x coordinates of all the turtles?

EXTENDING THE MODEL

As the model stands, it plots two lines (right and left) over time. Another way to look at this simulation is to plot the distribution of turtles. Create a histogram to show this type of data.

The turtles will stop if they come up to an obstacle (cannot move forward or to the right/left), give the turtles the ability to think ahead and choose a different step/direction.

Give the turtles the ability to walk backwards.

Create a three dimensional lattice.

NETLOGO FEATURES

Since turtles in this model only move in the positive direction and they start at the bottom the origin is relocated to be at the bottom of the view also, so there are no patches with negative pycor.

RELATED MODELS

Random Walk 360, Galton Box, Binomial Rabbits

HOW TO CITE

If you mention this model or the NetLogo software in a publication, we ask that you include the citations below.

For the model itself:

Please cite the NetLogo software as:

COPYRIGHT AND LICENSE

Copyright 1997 Uri Wilensky.

CC BY-NC-SA 3.0

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at uri@northwestern.edu.

This model was created as part of the project: CONNECTED MATHEMATICS: MAKING SENSE OF COMPLEX PHENOMENA THROUGH BUILDING OBJECT-BASED PARALLEL MODELS (OBPML). The project gratefully acknowledges the support of the National Science Foundation (Applications of Advanced Technologies Program) -- grant numbers RED #9552950 and REC #9632612.

This model was converted to NetLogo as part of the projects: PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS and/or INTEGRATED SIMULATION AND MODELING ENVIRONMENT. The project gratefully acknowledges the support of the National Science Foundation (REPP & ROLE programs) -- grant numbers REC #9814682 and REC-0126227. Converted from StarLogoT to NetLogo, 2002.

(back to the NetLogo Models Library)