Skip to content

Quantam-Studios/Natural-Selection-Simulator

Repository files navigation

Tools

Natural-Selection-Simulator

A simulator of natural selection with predator-prey relationships.

Purpose

This software was made for people who want to see the effects of predators on which traits are expressed in what ways in prey.

Features

The referenced paper is the attached pdf: Do Predator-Prey Relationships Affect Whether Sexual or Asexual Reproduction Is Advantageous?

  • Asexual, sexual (male/female), and hermaphrodite prey.
  • Asexual, sexual (male/female), and hermaphrodite predators.
  • Priority based decision making (see Methods and Procedure section of the attached pdf).
  • Conserved energy.
  • Automatic logging of all data.
  • Configurable settings in a GUI.
  • Prey and predators alike can sense the world around themselves.
  • Roughly 800 creatures can be simulated without dropping below 60 FPS.
  • Size, sense radius, and speed are all inherited traits.
  • Trait values are not fixed, but smoothed allowing for greater variation.

How To Use

Download the latest build from the releases section on the right of this page. then follow the below steps to get up and running.

  1. Begin setting up simulation by pressing the “Setup A Simulation” button.
  2. Select the desired settings for the test.
  • Choose the prey reproduction type
  • Choose the initial amount of prey
  • Optional: Choose the predator reproduction type
  • Optional: Choose the initial amount of predators
  • Choose the initial amount of food
  • Choose the spawn rate of food
  • Choose the data collection rate
  • Choose the time limit
  • Choose a folder name
  1. Click the “Run Simulation” button.

Once you are in a simulation you can press the space key to pause it. This will bring up menu where you can quit the current simulation, set the time speed up value, and of course, resume the simulation.

Background Information

The Following text is from the Review of Literature section in the attached paper (pdf): Do Predator-Prey Relationships Affect Whether Sexual or Asexual Reproduction Is Advantageous (1).pdf.

What Is Natural Selection?

The idea of natural selection was formed as part of Charles Darwin’s theory of evolution in 1859. Natural selection is the idea that over time populations of living things adapt more and more to the environment around them. For example, an individual may possess a certain trait that makes it more likely for it to survive; that individual is then more likely to reproduce, passing the successful gene (and trait) onto the next generation. Natural selection is limited by certain rules (Khan Academy, n.d.). A species’ traits and/or tendencies only change to reflect the current environment; genes tend to stay in a species if individuals with that gene survive long enough to mate (reproduce). However, the limited range of traits for a given species are determined by the available genes (making up the gene pool)--so new traits do not spring up from nowhere--unless there is a new mutation that can be tested against the selection pressures of the environment. When a species has a large population with a distribution of genes, natural selection essentially experiments with which traits or genes should stay in species to help keep it alive over time. Eventually, favored traits will win out. Natural selection cannot work without a reproducing population. For most species, the absolute minimum number is 2 of a species in a given place (e.g. one male, one female). However, species that can reproduce asexually only need 1. Reproduction is when the changes to a population can really take place. Natural selection can’t change a species’ current generation, but rather the following generation would be where the changes occur in the population (for example, genes leading to improved survival would be more common).

Sexual Reproduction

Sexual reproduction requires two parents as well as two major cellular components. These are an egg (typically female), and sperm (typically male). When they come in contact with each other the parents’ alleles combine to start making new genotypes. This is why creatures that reproduce sexually tend to look similar but not exactly like their offspring. This form of reproduction has a few flaws. One big issue is if a population is very low, and a female can’t find a male or vice versa, then the population would die, and eventually become extinct. Another issue is that it does not guarantee that beneficial genes will be passed down to the offspring. However there are also some clear advantages to reproducing this way. For instance, if a bad gene was in a parent then it has a chance of not being passed down to the offspring. A very important aspect of sexual reproduction is the ability for mutations to occur during the genetic reshuffling. This is generally a good thing because it makes more variety among the population, decreasing the chance for one single thing (selection pressure) to wipe a population out.

What Is A Hermaphrodite?

Hermaphrodites are a special type of sexually reproducing creatures. Instead of having different sexes lime most sexually reproducing organisms where one carries an egg, and the other carries sperm, hermaphrodites have both egg and sperm (Britannica, n.d.). In reference to the issues brought up in the Secual Reproduction section, when a species is hermaphroditic it can allow them to find mates quicker because they don’t need a specific sex, but instead simply another creature in their species.

Asexual Reproduction

Asexual reproduction requires only one parent, and can be done 4 different ways. These are binary fission, budding, fragmentation, and parthenogenesis (Khan Academy, n.d.). Essentially asexual reproduction is cloning. One flaw that comes with reproducing this way is that any bad genes that the parent had are virtually guaranteed to be given to the offspring. However, if a parent has a good gene, the offspring will receive it too, which is good. This form of reproducing has no chance of variation except for occasional random mutation. This lack of variation in a population can be bad in the long term, due to there not being a large enough variety among a population’s individuals, so a single complication (e.g. a new predator or disease) could wipe them all out at once.

Predator-Prey Relationships

Predation theory is a very old idea, but one of the first people to realize it was a mathematician by the name of Volterra. He observed that when the fishing business in the Adriatic sea was good there would be lots of fishermen, but overtime the amount of fishermen would decrease, possibly because of an over harvest. This pattern would repeat in a cycle (University Of Michigan, 2005). These observations support that as the population of a predator (fishermen) increases the population of the prey (fish) decreases. As well as when the population of the prey (fish) rises the population of the predator (fishermen) rises as well.

Carrying Capacity

Carrying capacity is the amount of creatures in a population that can be supported by the environment. According to Britannica, “The carrying capacity is different for each species in a habitat because of that species’ particular food, shelter, and social requirements.” (Britannica). This leads the population to drop when it is over the carrying capacity, and rise when under it.

Why is Sexual Reproduction Still Present?

This previous simulation gave a realistic result of coevolution between predator and prey that favors sexual reproduction. However, is a predator-prey relationship necessary to favor sexual reproduction? Otherwise, asexual reproduction seems like it would be the best form of reproduction because asexual reproduction is easier--because one does not need to find a partner, and thus the population count could skyrocket from a single well-adapted individual. However this isn't what the majority of species on Earth do, instead nearly all continue to reproduce sexually. This seems strange, because a well-adapted individual can only pass on half of its genes (E Klarreich, 2010). S Scheu and B Drossel designed a model that looked at the effect of resource availability. They used creatures that could reproduce sexually or asexually where “...sexual reproduction sets in when resources become scarce, and that at a given place only a few genotypes can be present at the same time” (S. Scheu, 2007). Their model allowed for mutation that could benefit or take away from a species. The simulation ends when only one form of reproduction is left. The results showed that sexual reproduction took over in every scenario except one, when survival conditions are at their worst and the death rate is too high for sexual reproduction to function (S. Scheu, 2007).

The Math of Simple Gene Variation

One of the simplest methods scientists use to predict what genes a child or offspring of sexual reproducing creatures could receive is called a Punnett Square. “One of the easiest ways to calculate the mathematical probability of inheriting a specific trait was invented by an early 20th century English geneticist named Reginald Punnett. His technique employs what we now call a Punnett square. This is a simple graphical way of discovering all of the potential combinations of genotypes that can occur in children, given the genotypes of their parents. It also shows the odds of each of the offspring genotypes occurring.” (Dennis O'Neil, 2012). When making a Punnett Square one starts by making a small 3 by 3 grid on paper. Next, one would put the genotype of one parent across the top and the other parent’s genotype down the left side, leaving a 2 by 2 space. It does not matter which parent's genotype you put on the top or side as it will give one the same results. After that all you have to do is fill in the remaining boxes by copying the row and column-head letters across or down into the empty squares. Once one finishes mapping out the genotypes they have all the possibilities of the gene that the offspring can get (assuming no mutations). In order to understand the data one should know the different identifiers, specifically homozygous, and heterozygous. Homozygous refers to a gene that has identical alleles on both homologous chromosomes. It is referred to by two capital letters (AA) which is homozygous dominant, and two lowercase letters (aa) for homozygous recessive (assuming that a given gene can be dominant or recessive). Heterozygous means having one of each two different alleles (Aa). As will be mentioned below, in the simulations created for this work, dominant/recessive genetics were not used. Instead, the offspring for asexually reproducing creatures were essentially clones, and the offspring for sexually reproducing creatures (treated as hermaphrodites--creatures with both male and female characteristics) had “weighted averages” calculated from the parent “gene values” to determine “phenotypes” for their inheritable characteristics.

Mutation

Whenever the process of reproduction is happening there is a chance of mutation occurring. Mutation is an error in the DNA often caused by the miscopy of an allele, or over exposure to things like ultraviolet light or other types of ionizing radiation. The dictionary definition is, “ a relatively permanent change in hereditary material that involves either a change in chromosome structure or number (as in translocation, deletion, duplication, or polyploidy) or a change in the nucleotide sequence of a gene's codons (as in frameshift or missense errors) and that occurs either in germ cells or in somatic cells but with only those in germ cells being capable of perpetuation by sexual reproduction” (Merriam Webster, n.d.). Mutation adds random uncertainty to natural selection. Most genetic mutations actually don’t do anything. Others can be beneficial; for example, a mutation can make a creature immune to disease, or more energy efficient. On the other hand, mutations can make creatures worse off, for example instead of making something immune to a disease it might make it more vulnerable, or instead of making something more energy efficient it could make it less energy efficient--or more vulnerable to a predator. In the simulations described below, there was a 10% chance of mutation with every reproduction.