NetLogo banner

NetLogo Publications
Contact Us

Modeling Commons

Beginners Interactive NetLogo Dictionary (BIND)
NetLogo Dictionary

User Manuals:
Farsi / Persian


NetLogo Models Library:
Curricular Models/BEAGLE Evolution/HubNet Activities

For information about HubNet, click here.

(back to the library)

Guppy Spots HubNet

[screen shot]

If you download the NetLogo application, this model is included. You can also Try running it in NetLogo Web


This selection model shows how sexual attraction and predation change the coloration and patterns in guppy's population. When you run the model, you can either play the role of a predator or the role of a mate. As a predator, you will probably notice the more brightly colored guppy males. In other words, the more colored the guppy is, the more likely he will be seen by you, the predator. In this model, (as happens in the wild in streams where predators are plentiful), male guppies become increasingly drab over generations, pushed by predation pressure toward greater camouflage.

If you have not seen guppies you can see some at the "Sex and the Single Guppy" webpage. You can notice that many guppies are very colorful, have garish patterns and large tails, even if it makes them more noticeable to predators. You might ask yourself: why doesn't a guppy remain camouflaged and discreet in order to avoid the detection by a predator?

The answer lies in the fact that guppies are driven by more than only a survival instinct. Guppies also desire to reproduce with other guppies and to do this they must be noticed by their mates. The "flashier" a male guppy is, the likelier a female guppy will choose him as a mate, passing his genes to the next generation. This is sexual selection at work, and it is the force that drives guppy's coloration toward conspicuousness just as hard as predation pushes coloration toward drabness.

Thus as a mate, you will again probably notice the more brightly colored guppy males. When you click on a colorful mate, he will hatch an offspring, which will likely create another colorful guppy and guppies will increasingly become colorful over generations, pushed by breeding pressure.

Quoting from "Sex and the Single Guppy" [2]:

There may be several evolutionary reasons why female guppies prefer flashy males. On the most basic level, the male with the biggest, brightest tail spot announces most loudly, "Hey, I'm over here" to any female it can see. Flashy colors are simply easier to locate. However, there is also research to suggest that bright colors serve as an indicator of good genes in the way the strong physique of a human athlete is a direct indicator of that individual's health and vitality. Or, bright coloration may signal to a potential mate that he's got something else going for him. After all, he's been able to survive the very handicap -- conspicuousness to predators -- that his flashiness creates.

Whatever the reasons, it is clear from the research of Endler and other evolutionary biologists that male guppies live in the crossfire between their enemies and their would-be mates, with the opposing forces of predation and sexual selection forever pushing the guppy coloration in opposite directions.


You can assume either the role of a predator or the role of a mate.

When GO is pressed, if you are a predator you should try to click on the guppies, as fast as you can, in order to eat them. Each time you click on a guppy it will be removed from the guppy population. At that point, another guppy in the population will hatch an offspring to replace the one that was caught (keeping the population of guppies constant).

If you are a mate (a female guppy), you should try to click on the guppies as fast as you can (they are all males). When you click on a guppy that is old enough to mate, he will hatch an offspring. When the population of guppies exceeds the capacity, a random guppy will be removed.

Each new guppy may undergo small mutations in its genetics for each of its three fins. These mutations will results in changes in the size and the three pigments that make up the color of each fin.

Predators prey on the most brightly colored or patterned individuals more often than the less colored ones since they are easier to spot and eliminate them from the gene pool. Thus, predators cause guppy populations to remain relatively drab (with respect to colors and patterns of the environment they live in).

However, guppies looking for a mate exert the opposite selection. Relatively drab guppies are hard to find and mate with, while guppies with garish colors and patterns are easier to find and mate with. As these guppies reproduce, the frequency of their genes increases in the gene pool.

Guppy populations are evolving to match, and/or stand out, from their environment depending on which of the selective pressures are stronger.


To run the activity press the GO button. To start the activity over with the same group of students stop the GO button by pressing it again, press the SETUP button, and press GO again. To run the activity with a new group of students press the RESET button in the HubNet Control Center.


SETUP - Clears the world and populates the world with fish. All players are set to initial values. GO - Runs the simulation, students can login and start eating, or mating with the fish population. CHANGE BACKGROUND - loads the image selected in the BACKGROUND chooser into the drawing. CLEAR BACKGROUND - erases the drawing so the patches show through.


FISH-SPEED-SCALE - controls how quickly the fish move around the world CARRYING-CAPACITY - the simulation will automatically keep CARRYING-CAPACITY fish in the world at all times. If there are too many fish it will randomly kill some, however, if there are too few fish, a random fish already will automatically be reproduced. Note that CARRYING-CAPACITY will only be active when the ENFORCE-CAPACITY? switch is in the "on" position. MIN-AGE-REPRODUCTION - The minimum amount of time before a fish can reproduce after it is born and since the last time it reproduced. BACKGROUND-COLOR - the value of the color of the background (patches), which is only visible when there is no image loaded in the drawing.


ENFORCE-CAPACITY? - When it is on, the simulation automatically maintains number of fish in the world at CARRYING-CAPACITY. SHOW-AGE? - When it is on, set the label of each fish to its age. ROCK-SHELTERS? - When it is on, a rock shelter is placed on top of the world, as new fish are born they emerge from the rocks rather than appearing where its parent was at the time of reproduction.


FISH - The number of fish in the world. MATES - The number of students logged in as mates. PREDATORS - The number of students logged in as predators. MATES-LEADER - The name of the student (or indication of a tie) with the highest number of mates found. PREDATOR-LEADER - The name of the student (or indication of a tie) with the highest number of prey found. MATES-FOUND - The number of mates found by the leader. PREY-FOUND - The number of prey found by the leader. TOTAL-MATES-FOUND - The number of mates found by all mates. TOTAL-PREY-FOUND - The number of prey found by all predators.


BACKGROUND - Select the name of the background image to use in the world. PLAYER-ROLES - Select the type of game to play so you can explore the affects of the two forces (mates and predators) separately and in competition with each other.


FOUND V TIME - The number of fish found by both predators and mates over time.

Global variables in the procedures to change

WANDER-ANGLE - The amount that the fish will wiggle when they move around the world. MAX-COLOR-MUTATION-STEP - the maximum amount that a color gene can change by in one step CHANCE-MUTATE-COLOR - The percent chance the fish parts will slightly change color when reproduced CHANCE-MUTATE-SIZE - The percent chance the fish parts will slightly change size when reproduced MAX-FISH-SIZE - A limit on the size fish can grow to, to keep the simulation reasonable MAX-SIZE-MUTATION-STEP - the maximum amount that a size gene can change by in one step


Select ALL MATES in the PLAYER-ROLES chooser, run the activity and notice the results. Are the fish very colorful or are they drab?

Do the same with ALL PREDATORS and MATES V PREDATORS, which force wins out in the end?

Try different backgrounds to see if the drab color of the guppies becomes closer to the common objects in the background (backlit seawater, rocky bottoms, green plants, etc.).

Try to run the model without using a backdrop and instead adjust the color of the patches using the BACKGROUND-COLOR slider.


It can sometimes be difficult to click on the fish because catching fish is dependent on patch boundaries. Change it so it uses in-radius instead.


This model uses import-drawing to load high resolution backdrops into the drawing layer. However, the fish do not directly interact with the background; it only affects how the users see the world.


  • Bug Hunt Pursuit
  • Peppered Moths


[1] Inspired by Sex and the Single Guppy. [2] Sex and the Single Guppy. Conclusion: Exhibitionism Explained.

This model is part of the BEAGLE curriculum (


If you mention this model or the NetLogo software in a publication, we ask that you include the citations below.

For the model itself:

Please cite the NetLogo software as:

Please cite the HubNet software as:


Copyright 2006 Uri Wilensky.


This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at

(back to the NetLogo Models Library)