This project is a simple simulation of how a snake uses one
form of locomotion, LATERAL UNDULATION, to slither across
the ground. Lateral undulation, also called SERPENTINE
LOCOMOTION, is the most common form of movement for legless

Using the sliders, select the size of the snake and the
terrain topography. FRICTION is the base friction of the
ground. There are four types of terrain: 0 is a random
terrain setting (with ECCENTRICITY to determine just how
random), 1 is a uniform piece of ground, 2 is a two-leveled
terrain, and 3 is a three-leveled terrain.
Press the SETUP button to generate this terrain (and the
snake).  Press MOVE to start the snake going- he'll attempt
to follow the mouse. Move it around to see how he follows
it, and what he does once he's gotten to it. The STEP button
allows you to walk the snake forward just one patch.

The black patches are special areas called PIVOT POINTS. The
snake uses these to push himself forward- he pushes against
them, and the resulting forces create a vector in the
general direction the snake wants to move (the AXIS OF
TRAVEL).  Usually, the snake chooses three pivot points,
spread out along the length of the snake, and never all on
the same side.

Notice that, wherever the head goes, all subsequent coils
follow it. In other words, if the head and neck move through
some patch, every other coil will move through that patch.

As the snake moves over the terrain, it reacts to the friction
level beneath itself.  Over an area of low friction, the snake
can move relatively straight along the axis of travel.  As the
friction gets higher, though, he is forced to 'squirm' from side
to side more often.

* Lateral undulation, although used by most snakes, isn't
always possible. It requires objects on the ground that the
snake can press against. Snakes cannot move through narrow
tunnels or burrows using this form of movement, nor can they
move across water or over desert sands. How can the snake
move across such surfaces? What other forms of movement are
there, and how are they similar to this form?

* In this model, the snake simply moves wherever the motive
force, combined with the direction of the OBJECTIVE (in this
case, the mouse), pushes it.  However, in reality, snakes
move towards the objective as much as they can, actively
seeking out all pivots it can find along the way. Try to
invent a nice search algorithm, so that the snake would
search locally for a nearby pivot (preferably along the axis
of travel), meanwhile always keeping this axis oriented
towards its objective.

* StarLogo allows for BREEDS- different classes of turtles.
One breed of turtles could represent the snake, another
could represent some rodents in the vicinity. Different
breeds can carry out different commands, despite their both
being turtles- for instance, the snake breed could home in
on members of the mouse breed, while the mouse breed could
try and stay away from the snake and each other.

To choose pivot points, StarLogo calls the primitive
WHO-MAX-OF-TURTLES-WITH [...] [...].  The snake picks three
pivots: one in the first third of his body, one in the
second, and one in the third. Whichever coil in each of
these ranges has the highest level of friction below it is
picked. (Thus if the snake cannot find a good pivot, it can
make do with whatever else is around it, to a lesser effect.)