Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
Calendar
Upcoming eventsCookbook |
Putting Turtles in BoxesHow do you start turtles off in a confined space, like a room or a box? Solution:
To force a position for a turtle, you can use set xy. To figure out what we want to put in the values for xcor and ycor, first we'll describe the size of the box by finding the difference between the minimum and maximum coordinates of the box for both x and y. This means we subtract the smaller x coordinate from the larger, and the same with the y coordinate. My smaller x coordinate is -39 and my larger is -11.
You can call this from anywhere in your code. This example I put in the Setup code of an epidemic model. Of course, this doesn't stop agents from leaping over walls.
See also:
Submitted by talaya on 15. January 2009 - 21:12
|
Login (optional)Navigation |