Peacock Simulation



Introduction

Peacock
Peacock

Peacock tails are well known for their elaborate coloration. Charles Darwin suggested that they serve to attract females, and that the showy features of the male peacocks have evolved by sexual selection. The idea is that if peahens prefer to mate with the most colorful males, the genes for showy tails will have an advantage over genes for boring tails. Without getting into the scientific debate about this theory, I would like to have some fun with it.

What would happen if peahens prefer red or green or blue colors? To find out, I wrote a script that can generate ‘peacock tails’ with colors that can change by small mutations. The script simulates a number of generations in which peahens pick their mates based on the colors of the tail.

As it has to be a simplified model, I imagined a peahen that can look on a computer screen and pick her preferred colors. Colors on a computer screen use the RGB color model in which the Red, Green, and Blue colors of light are added together to produce a wide range of colors. Each of these three colors is identified by a number between 0 and 255. A color on a computer screen is defined by three numbers: one for red, one for green, and one for blue. For example rgb(0,255,0) is the code for ‘blue’, rgb(255,255,0) is the code for ‘yellow’, and rgb(211,211,211) is a shade of ‘gray’.

Simulated peacock tail
Simulated peacock tail

My simulation model generates colorful tails. The peahen looks at the screen, quickly analysis the RGB codes of the tails, and picks her preferred tail. For example if the hen prefers red, she will pick tails where she finds higher numbers in the ‘red’ part of the colors.

How to run the simulation?

In the form below you can adjust the following settings before hitting the ‘Simulate’ button.

  1. Set the number of generations to simulate.
  2. Set the number of male peacocks. This determines how many tails you will see in each generation. At the start of the simulation the tails of these peacocks are randomly generated, so they will be different every time you hit the ‘Simulate’ button.
  3. Set the number of kids. Each of the male peacocks will father a number of kids, which have more or less the same color as their father, but with some random mutations. If for example you have 3 male peacocks who each are father of 8 kids, we will get 24 kids, all with slightly modified colors. The peahens will pick 3 of these 24 for the next generation.
  4. Make the tails bigger or smaller by selecting how many circles will be drawn by the script.
  5. Set how many radii should be drawn by the script. With more radii, the tails will have shapes with different colors.
  6. Adjust the width of the lines that are drawn between the colors.
  7. Set the mutation rate. Mutations of colors happen by slightly increasing or decreasing the 3 number of the BGB code. You can select a maximum number of points that the codes can be modified in each generation. Select a higher number to mutate faster.
  8. Set the color preference of the peahens, either red, green or blue. The preferred color will be used to decide which kids move on to the next generation. The other two colors will be ignored by the hen; they will keep mutating but are not involved in the sexual selection.

Try it. The tails for all generations will appear on the screen, so you will have to scroll down to see how the colors evolve. At the bottom of the screen you get a graph which shows the average colors for each generation.

Note: In the graph you will often see a big jump in the first generation. That is because the simulation starts with randomly generated tails. These initial peacocks can be quite different. Often, only kids of one of these random peacocks will contribute to the next generation.

Tip: Hide this introduction text while running the simulations.

Settings for the simulation







Color preference     | | |


Results







Scroll to Top