# CSCE 782: Problem Set 0

## Due: Never

**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.

### Questions

José M. Vidal
Last modified: Tue Aug 28 13:13:32 EDT 2007