WHAT IS IT?
-----------
'diffusion-graphics' is unlike most other StarLogo models,
in that it really doesn't 'model' anything. It simply
explores the power behind an interesting patch primitive,
'diffuse'. In this model, a few patches are designated as
'hot-spots', places where a certain value (a patch variable
called 'v') is being reset to the maximum level every time
step. Each patch, through the 'diffuse' primitive, then
shares its value of 'v' with its surrounding patches. You
can think of 'v' as something like heat, which slowly
spreads itself evenly across a plane. (See the Connected
Mathematics model 'diffusion' for exactly such a thing.)

Here, you can watch what happens as hot-spots interact with
each other, as they move around, as their values become
negative, or as the heat (i.e. 'v' or simply their color,
'pc') slowly decays down to nothing. The whole point of the
project is to give you an idea how patches interact via the
'diffuse' primitive. (Or maybe just to give you something
nice to stare at if you're bored.)

HOW TO USE IT
-------------
Two buttons, SETUP and GO, control execution of the model.
As in most StarLogo models, the SETUP button will initialize
the 'hot-spots' and other variables, preparing the model to
be run. The GO button, a forever button, will then run the
model.

Three sliders and three switches determine the various
properties of the model. Each of them can be set prior to
initialization, or can be used mid-run to affect what
will happen.

NUM-BODIES determines how many 'hot-spots' there are. Each
of these 'hot-spots' constantly updates its color to the
current value of 'curr-v', and then diffuses it into the
nearby patches. 

The 'curr-v' value is simply a StarLogo color. You can
see what its value is in the CURR-V monitor in the interface
window.

The CHANGE-RATE slider is the rate at which the colors
diffuse out from each patch. All patches diffuse their color
value to their neighbors each time step. CHANGE-RATE is
simply a percentage of this color leaked out.

DECAY-RATE is the rate at which 'curr-v' decreases. When
non-zero, 'curr-v' will slowly diminish, causing the colors
diffused throughout the patches to revert slowly to brown,
red, grey, and finally back to black, when curr-v is 0.

The WEIRD switch determines whether or not curr-v can fall
below zero, once it has decayed to that point. When WEIRD is
1, curr-v can be negative; otherwise, it will simply stay at
0. (The name comes from the effect that negative values will
produce for the color diffusion...)

The WANDER switch allows the 'hot-spots' to move around the
graphics screen when set to 1. If 0, the hot-spots will stay
rooted in place.

Finally, the ROY-G-BIV switch allows you to switch from
StarLogo color representation (which might not make too much
sense unless you are already used to it), to a more standard
representation. The name "ROY-G-BIV" comes from the common
mnemonic for remembering the colors of the rainbow: red,
orange, yellow, green, blue, indigo, violet. (I take a
couple of liberties with this order, but nothing too radical.)

If DECAY-RATE is greater than zero, then the color diffusion
will be opposed by, and slowly overtaken by, the fact that
the hot-spots' color eventually reduces to black (so that
they, in effect, are diffusing black throughout the other
patches). However, 'curr-v' can be reset to its maximum
value (135, or 'pink', the highest basic color that StarLogo
offers) with the REJUVENATE button. Its only function is to
restore the hot-spots' colors ('curr-v') to the maximum.

THINGS TO NOTICE
----------------
Mainly what 'diffusion-graphics' will show you is how patch-color
is diffused in StarLogo. The graphical display may evoke
fractal imagery, or a topographical landscape.
'diffusion-graphics' really does bring about a topography of
sorts, with the hot-spots being peaks, and the darkest
colors being valleys. The model essentially tries to then
smooth out these differences.

Let the model run for awhile with DECAY-RATE, WEIRD, and
WANDER all off (all set to 0). Watch what happens to the
'terrain'. What do you predict will eventually happen?

Then increase DECAY-RATE. Watch 'curr-v' drop, and watch how
the landscape changes. Turn on WEIRD once 'curr-v' reaches
0. What happens, and why? More importantly, what does this
tell you about color-representation within StarLogo?

Compare and contrast between the two color representations
that 'diffusion-graphics' has to offer: with ROY-G-BIV on or
off. Which mode do you prefer?

This model was built to please. Just play around with the
sliders and switches. Later, try altering the code and see
what works (and what doesn't work, too).

THINGS TO TRY
-------------
Try reducing or increasing the number of hot-spots present
in the model (i.e. the NUM-BODIES slider), while the model
is running. 

Try setting the maximum value of 'v' to something smaller
(or larger) than 135.
You can change this in the code itself, in the procedure
'setup'. (There is a short line of code that says
'setmax-v pink'. 'max-v' is a global variable that
represents this maximum amount. We set it to 'pink', as
pink is the color with the highest numeric value in
StarLogo.) An alternative way to reduce 'max-v' is
via 'curr-v'. The hot-spots really set their values to
'curr-v' each step- 'max-v' is simply used whenever the
REJUVENATE button is pressed. Set DECAY-RATE to some high
value (e.g. 1.0), and wait for 'curr-v' to descend to the
desired value. Turn off DECAY-RATE and watch what happens to
the colors.

Try setting the patch size to 2x2 or 1x1 for a richer
display. Or set the patch size to 16x16, for a 'zoomed-in'
perspective.

EXTENDING THE MODEL
-------------------
In 'diffusion-graphics', the position of each hot-spot is
determined randomly at setup. Change the model so that the
user may select hot-spots with the mouse. Or change the
model so that the location of hot-spots is dynamically
determined during the run. (So that if I press SETUP with
NUM-BODIES set to 8, and then press GO, I will see 8
hot-spots begin to run. Then if I reduce NUM-BODIES, and
later increase it, the new hot-spots will be in different
locations than they were before.)

StarLogo allows the observer to take lists as variables.
These lists do not have to be of any fixed size. As
hot-spots are represented as observer variables ('globals')
anyway, it should be relatively easy to change how the
hot-spots are represented- give the observer a list of
coordinates. This will allow you to have far more than just
eight hot-spots, and reduce the number of global variables
used by the model.

STARLOGO FEATURES
-----------------
The 'diffusion-graphics' model was designed around the
'diffuse' primitive. 'diffuse' takes two arguments, a patch
variable and a number (This number must be between 0 and 1;
here, it is given by the value of the CHANGE-RATE slider.)
It tells each patch to give a percentage (equal to the
number) of the given variable to the eight surrounding
patches. So if I say: 'diffuse v 0.5', I tell each patch to
give half of 'v' to the eight other patches, which will then
use that as their new 'v' value. In other words, each patch
sets its given variable to: the total of % of
 from each neighbor. (E.g. if all patches have 'v'
as 100, and I say 'diffuse v 0.67', then each patch will now
have 'v' set to ((0.67 * 100) + (0.67 * 100) + (0.67 * 100)
+ (0.67 * 100) + (0.67 * 100) + (0.67 * 100) + (0.67 * 100)
+ (0.67 * 100)), or (8 * (0.67 * 100)), or 536.) It may seem
confusing; however, try to work out a couple of examples on
paper, and use StarLogo itself to confirm your results.

Another feature that 'diffusion-graphics' uses is that new
interface object, the switch (new, at least, as of StarLogo
2.0.2t1). You can think of a switch as just a scaled-down
slider- it has only two values, whose max, min, and
increment values are all pre-defined. You can set it and
check its value, like sliders- e.g. you would say 'setweird
1' or 'if (wander = 1) [...]'. Switches are best used to
define Boolean variables, that is, a variable whose value is
only 'true' or 'false'. 'weird' and 'wander' are Booleans.
(A word of caution about Boolean data-types in StarLogo:
'true' and 'false' are constants that evaluate to 0 and 1
respectively. This differs from most other programming
languages, where false is 0, and true is non-zero. 'weird'
and 'wander' correspond to this latter representation- when
WANDER is set to 1, the hot-spots will move around. Always
be consistent in your code- in the future, 'true' and
'false' in StarLogo may conform to the normal convention of
1 and 0 instead of 0 and 1 as they are now.)