This project uses StarLogo turtles to repeatedly draw
circles, turning periodically so that the display gives the
impression of a kaleidoscope or pinwheel.

The NTURTLES slider really determines the number of 'arms'
or 'petals' that the kaleidoscope will have. Begin by
setting this slider to the desired value (10 is fine).

Next, set COLOR-SEP to some value. COLOR-SEP basically
determines the range of colors that the turtles (and hence
the kaleidoscope) will take on. The higher the value, the
smaller the range. (For a nice, three-colored kaleidoscope,
set COLOR-SEP to 25.) This inverse relation between
COLOR-SEP and the color range is due to the fact that
COLOR-SEP acts as a constant to divide a turtle's color by.

When you have set both NTURTLES and COLOR-SEP, press the
SETUP button to set your kaleidoscope in motion.

Next, choose which pattern you want. Each pattern has its
own forever-button that controls it. PATTERN-1 has the arms
of the kaleidoscope all spiraling clockwise, while PATTERN-2
has the arms of the kaleidoscope spiral to both clockwise and
counterclockwise, giving a slightly more complicated design.

Finally, you have the power to change the color distribution
exhibited by 'kaleidoscope'. The COLOR-SHIFT button will
either increment or decrement the value of 'color-sep' used
by the turtles- saved internally as 'curr-color-sep'. (Thus
the slider value itself isn't changed, but the number the
turtles look at is.) This number is changed by a small
random amount. The INCREASE-C? switch determines if
'curr-color-sep' is increased (true) or decreased (false).

You also have two monitors at the bottom of the Interface
Window. COUNT-TURTLES will simply display the current number
of turtles onscreen. Likewise, CURR-COLOR-SEP will display
that variable's value, so that you know when it has been
altered, and by how much.

First, just try playing around and observe what happens.
'kaleidoscope' is foremost meant to be a visually pleasing
model just to watch. See what different values of NTURTLES
and COLOR-SEP produce, and explore how COLOR-SHIFT changes
the appearance of the kaleidoscope. What seems the best to

An important thing to notice here is the number given in
COUNT-TURTLES. Right away, it becomes much larger than
NTURTLES, but quickly settles on some nice big number. Take
a look at the Procedures Window. There are really two levels
of turtle commands going on here. Initially, upon setup,
there are NTURTLES number of turtles. Once one of the
pattern buttons is pressed, each of these turtles (who compose
the 'arms' of the kaleidoscope) repeatedly hatches a new
turtle and turns by a single degree. The newly-hatched
turtles begin to draw circles, self-destructing upon
completion. As the 'arm' turtles execute their commands much
quicker than the hatched turtles, they produce many turtles
during one loop of a circle; eventually, though, turtles
start to die off. At this point, the number of turtles who
are born is roughly equal to the number who die at any given

You also should notice how COLOR-SEP (or really 'curr-color-sep')
alters the appearance of the kaleidoscope. Turn COLOR-SHIFT
on, and let 'curr-color-sep' become very large. Then watch
what happens when it is small, maybe zero or some negative number.

Try changing the code in the Procedures Window. Increase the
size of the circles drawn by each of the turtles, or try
changing the size of the angle each of the turtles turn

Instead of each turtle moving or turning a given amount,
what about having it move a small random amount (as in the
changes to curr-color-sep from COLOR-SHIFT). How much
randomness can you add to 'kaleidoscope' and still maintain
some kind of overall structure?

Whenever a turtle is hatched by one of the 'arm' turtles, it
proceeds to draw a circle. Change the 'hatch' command list
so that it draws some other shape or pattern. Try to predict what
overall shape will emerge.

Currently, the only difference between the two patterns is
that PATTERN-2 has half of the 'arm' turtles circle to the
left, the other half to the right. Write your own pattern-
i.e. come up with a new command or set of commands for these
turtles to execute.

Try to write an entirely new kind of 'kaleidoscope' project.
In the current project, turtles spin off from a center core
of NTURTLES turtles. In your new project, maybe the drawing
turtles could orbit around some fixed (or moving) point-
look at the StarLogo projects 'n-bodies' and 'gravitation'.

'kaleidoscope' makes nice use of the turtle primitive
'hatch'. Whenever a turtle is hatched, it executes the
command list that follows the 'hatch' command. Generally all
it does is change its color or alter some variable- there's
no reason it can't run some other, possibly lengthy,
procedure. (Which is exactly what happens here.)