CSCE 782: Problem Set 0
Due: Yesterday
Figure 1: A picture of what your final program should look like. Click on the picture to see the applet and get the source code.
The turtles in the world go round and round
This is a simple exercise to help you get started working with
netlogo. Your goal is to implement a program which looks like
Figure 1 where all the turtles are moving around in a
circle. The program itself should not be any longer than about
half a page of code. The turtles can use the locations of the
others in order to calculate their move, but each turtle's
decision must be made independently, that is, without
communicating with other turtles. The buttons have the following
function:
- setup randomly places num-turtles on the
field.
- update moves the turtles one step, they should move
a distance of exactly speed at each time step.
- num-turtles is just that. If you change it while
the turtles are moving their number should still be adjusted
accordingly.
- clockwise determines wether the turtles should move
clockwise or counter-clockwise
- radius is the radius of the circle
- shake shakes all the turtles somewhat. They should
then be able to find their way back to the circle
Your turtles should do form the circle without using the
absolute coordinate grid. That is, you cannot specify, for
example, that the center of the circle is at 0,0. In fact, the
circle will probably move around the screen if you have a
correct implementation.
In order to keep everyone's programs roughly the same, you
should implement a turtle function called move which
does the actual work. The update function will simply
ask turtles [move] and the turtles will move exactly
speed.
Further Research
- Is your program as short as it can be? What is the smallest possible program?
- If you instandiated someone else's turtles, will the
resulting population still form a circle?
- Can you get your turtles to run around in a square? a
figure eight?
- What peculiarities can you observe and can you explain
them? For example, in my implementation I noticed that the
turtles can contract the circle a lot faster than they can
expand it (when I change the radius). I don't know why this
happens, yet.
Submission Instructions
As will all the problem sets, you will hand them in using our
department's dropbox. For the netlogo problem sets you will hand in
only one file, your .nlogo file. You will use the information tab of
the program for writing your detailed explanation of the techniques
you used, how the program works, how to set the controls to obtain the
different behaviors you want to show, etc. The information tab needs
to start with:
Name:
email:
ID:
I understand that it is the responsibility of every member of the
Carolina community to uphold an maintain the academic standards and
integrity of the University of South Carolina. Any member of the
University community, who has reasonable grounds to believe that an
infraction of the Code of Student Academic Responsibility has
occurred, has an obligation to report the alleged violation.
I certify that I have neither given nor received unauthorized aid on
this problem set.
Questions
José M. Vidal
Last modified: Wed Aug 28 16:24:48 EDT 2002