"Batesian mimicry" is the term used to describe an
evolutionary relationship in which a harmless species [the
mimic] has evolved so that it looks very similar to a
completely different species that isn't harmless [the
model].  A classic example of Batesian mimicry is the
similar appearance of monarch butterflies and viceroy moths.
monarchs and viceroys are unrelated species that are both
colored bright orange with black patterns so closely matched
as to be virtually indistinguishable from each other.  

The classic explanation of the phenomenon is that monarchs
taste yucky.  Because monarchs eat milkweed, a plant full of
toxins, they become essentially inedible to birds. 
Researchers describe monarchs vomiting within minutes of
eating a monarch butterfly.  The birds remember this and
avoid brightly colored orange butterfly/moth species. 
Viceroys, although perfectly edible, avoid predation if they
are brightly orange also because a bird can't tell the

Recent research now suggests that viceroys might
also be unpalatable to bird predators, confusing this
elegant explanation.  Nonetheless, we have modeled the
relationship anyway.  Batesian mimicry occurs in enough
other situations [snakes, for example] that the
explanation's general truth is unquestionable.  The
monarch-viceroy story is so accessible -- and historically
relevant -- that we believe it to be instructive even if its
accuracy is now questioned. 

This model simulates the evolution of monarchs and viceroys
from distinguishable, differently colored species to
indistinguishable mimics and models.  At the simulation's
beginning there are 900 monarchs and viceroys distributed
on the screen, in approximately equal proportions.  The
monarchs are all colored red, the viceroys are all colored
blue.  They are also distinguishable (by the observer only)
by their shape:  monarchs are represented as the letter "x" while
viceroys are shown as the letter "o".  Seventy birds are
also randomly distributed on the screen. 

When the model runs, the birds and butterflies [for the
remainder of this description "butterfly" will be used as a
general term for monarchs and Viceroys, even though Viceroys
are technically moths] move randomly across the screen. 
When a bird encounters a butterfly it eats the butterfly
unless it has a memory that the butterfly's color is
"yucky."  If it eats the butterfly, and the butterfly is a
monarch, the bird acquires a memory of the butterfly's color
as yucky.  If the butterfly eaten is a monarch, nothing

As butterflies are eaten, the butterfly populations are
regenerated through reproduction.  Reproduction is asexual. 
Each turn, every butterfly passes to "tests" in order to
reproduce.  The first test is based on how many butterflies
of that species already exist on the screen at the beginning
of the turn. The carrying capacity of the screen for each
species is 350.  The chances of reproducing are smaller the
closer to 350 each population becomes.  The second test is
simply a random check to keep reproduction in check [set as
a three percent chance in this model].  When a butterfly
reproduces it either creates an offspring identical or it
creates a mutant offspring.  Mutant offspring are the same
species but have a random color between blue and red, but
ending in five [e.g. color equals 15, 25, 35, 45, 55, 65,
75, 85, 95, 105].  Both monarchs and Viceroys have equal
opportunities to reproduce mutants.

Birds can remember up to three yucky colors at one time.  If
a bird has memories of three yucky color and eats a monarch
with a new yucky color, the bird "forgets" its oldest
memory and replaces it with the new color.  Birds also
forget yucky colors after a certain amount of time passes. 


Each turn is called a TICK in this model.

The MEMORY slider determines how long a bird can remember a
color as being yucky.  At the slider's maximum, a bird will
remember a color as yucky for thirty ticks.  At the slider's
minimum, the bird will remember a yucky color for zero
ticks.  In other words, it will not have any memory.

The MUT-RATE slider determines the chances that a
butterfly's offspring will be of a random color.  Setting
the slider at 100 will make every offspring a random color
[but a random color ending with a five].  Setting the slider
at 0 will make every offspring the same color as its parent.

The SETUP button resets the graphics and plot windows and
randomly distributes the monarchs (all red), Viceroys
(all blue) and birds.  The GO button starts the
simulation and the plotting function.

Numerous output monitors track the two butterfly populations
and their colors.  MNRCHS shows the number of monarchs on
the screen, and VCRYS shows the number of Viceroys. 
MNRCH-MAX and VCRY-MAX show the highest color value for the
monarch population and Viceroy population, respectively. 
[In this model, blue -- or color value 105 -- is the highest
color possible].  MNRCH-MIN and VCRY-MIN show the lowest
color value for the monarch population and Viceroy
population, respectively.  [In this model, red -- or color
value 15 -- is the lowest color possible].  MNRCH-AVG and
VCRY-AVG show the average color of all the monarchs and
Viceroys.  MNRCH-DEATH shows the number of monarchs that
have died in that turn.  VCRY-DEATH shows the number of
viceroys that have died in that turn.

The plot window produces a graph showing the average color
of the monarchs and the average color of the Viceroys
plotted against time.


Set the slider MEMORY to 25 and MUT-RATE to 5, push the
setup button and then push GO and watch what happens.

Initially, the birds don't have any memory and so both
monarchs and Viceroys are eaten equally. However, soon the
birds "learn" that red is a yucky color and most of the
monarchs are protected by this.  As a result the monarch
population makes a comeback towards carrying capacity while
the viceroy population continues to decline.  Notice also 
that as reproduction begins to replace eaten butterflies, 
some of the replacements are mutants and therefore randomly

As the simulation progresses, birds continue to eat, mostly
butterflies that aren't red.  Occasionally, of course, a
bird "forgets" that red is yucky, but a forgetful bird is
immediately reminded when it eats another red monarch.  For
the unlucky monarch that did the reminding, being red was no
advantage, but every other red butterfly is safe from that
bird for a while longer.  Monarch (non-red) mutants are
therefore apt to be eaten.  Notice that throughout the
simulation MNRCH-AVG continues to be very close to its
original value of 15.  A few mutant monarchs are always
being born with random colors, but it never becomes common
as the non-red mutants have slim chances of surviving long
enough to reproduce a lot. 

Meanwhile, as the simulation continues, Viceroys continue to
be eaten, but as enough time passes, the chances are good
that some Viceroys will be red mutants.  These butterflies
are likely to survive longer because they resemble red
monarchs and therefore to reproduce more before they die. 
With a mutation rate of 5%, it is likely their offspring
will be red too.  Soon most of the viceroy population is red
also as reflected in the VCRY-AVG monitor.  With its
protected coloration, the viceroy population will soon
return to carrying capacity.

If the MUT-RATE slider is set to high, advantageous color
genes do not reproduce themselves.  Conversely, if MUT-RATE
is too low, the chances of an advantageous mutant (red)
Viceroy being born are so slim that it may not happen
enough.  What is the most ideal setting for the MUT-RATE
slider so that a stable state emerges most quickly in which
there are red monarchs and Viceroys co-existing on the
screen?  Why?

If the MEMORY slider is set too low, birds are unable to
remember that certain colors are yucky.  How low can the
MEMORY slider be set so that a stable state of co-existing
red monarchs and Viceroys emerges.

If you set MUT-RATE to 100 and MEMORY to 0, you will soon
have two completely randomly colored populations.  Once the
average color of both species is about 55, return the
sliders to MUT-RATE equals 16 and MEMORY equals 30 without
resetting the model.  Does a stable mimicry state emerge? 
What is the "safe" color?  

One very simple extension to this model is to add a
RANDOM-COLOR button.  This button would give every butterfly
on the screen a random color.  The advantage of red would be
gone, but some color [which could be red, or any other
color] will eventually emerge as the advantageous color. 
This models the evolutionary process from an earlier
starting place, presumably when even monarchs had different

It would be interesting to see what would happen if birds
were made smarter than they are in this model.  A smart bird
should probably continue to experiment with yucky colors a
few times before being "convinced" that all butterflies of
that color are indeed distasteful.  

You could try to add variables that kept track of how many
yucky individuals of the same color a bird ate.  Presumably
if a bird has eaten several monarchs that are all the same
color, it will be especially attentive to avoiding that
color as compared to if it had just eaten one butterfly of
that color.  Making changes of this nature would presumably
make the proportion of models and mimics more in keeping
with the predictions of theorists that there are generally
more models than mimics.  In the current model, birds aren't
smart enough to learn that most butterflies may be harmless
in a given situation. 

In a real world situation, the birds would also reproduce. 
Young birds would not have the experiences necessary to know
which colors to avoid.  Reproduction of birds, depending on
how it happened and how often, might change the dynamics of
this model considerably.

One could also refine the mutation making procedures of the
model so that a butterfly is more likely to reproduce a
mutant that is only slightly differently colored than to
reproduce a mutant that is completely differently colored. 
In the current model, mutants' colors are simply random.

One limitation of Starlogo is that some variables cannot
have a higher value than 2^15 (32768).  In this model,
finding average color of a butterfly species requires adding
every individuals' color value together and dividing by the
total number of individuals (of that species).  Often, the
total of all the individuals' color values exceeded 2^15. 
It was necessary, therefore, to give each butterfly a
separate counting-kolor variable, which was simply the
butterfly's color divided by ten.

Notice that because special shapes cannot be given different
colors that appear on the screen, the butterfly shapes are
actually mostly white (matching the background) with
transparent paint making the X and O of the butterflies. 
Each butterfly stamps its patch with its kolor each turn, so
that that color can show through the transparent shape. 
Before moving, each butterfly stamps its patch white again.