Practical 2, part 1 - Creating the World
Before creating a model, we need to configure the world, or environment. We do
this by specifying how large we would like the world to be (how many patches) and by
specifying how the coordinate system works.
- Open NetLogo and create a new model (File - New)
The first thing we need to do is to set the size of the environment that we want to use.
- Right click on the display (the part that would usually show the agents) and choose
'Edit'.
You should see a window that allows you to configure the model world.
- Put the location of the origin (0,0) to be at the edge of the world on the bottom.
- Set the minimum x coordinate (
min-pxcor
) to zero.
- Set the maximum x and y coordinates (
max-pxcor
and max-pycor
)
to 20. This will give us a 20x20 cell grid.
- Tick the buttons so that the world wraps both horizontally and vertically. This means that
if a turtle leaves one side of the world they come back in at the other side).
- Leave the other variables as they are. See the right image to check you have configured the
environment correctly.
- Click OK. Now the world is ready.
That's all you need to do to prepare the environment. Check that you understand the
questions below, and then move on to part 2 to create
a button.
Questions
If you're not sure about any of the questions below, have a look at the
NetLogo interface guide, particularly the section on
views.
- If the world is a 20x20 grid, wow many patches will there be in the model?
- If you had chosen to place the origin (0,0) in the centre of the world, what
would the be the (x,y) coordinate of the patch in the bottom-left
corner?
- What about the patch in the top-right corner?
- What do the 'wrap horizontally' and 'wrap vertically' boxes do? (If you're not
sure about this, have a look at the
NetLogo interface guide )
[]
[]