Genetics Simulation

Use Scratch with the Hummingbird to create a genetics simulation.

Programming Language

Scratch, BirdBlox


Math, Science


6-8, 9-12

Free Teacher Materials

Get Access


This project demonstrates how the disciplinary core ideas LS3.A (Inheritance of Traits) and LS3.B (Variation of Traits) can be addressed at different levels of complexity. This aligns well with the progression described in the NGSS. A simulation like this would also be useful in teaching Common Core math standards focused on probability. A simple version of the project could be used in Grade 7 (7.SP.C), while a more complex version would be appropriate for high school (HSS.CP.A and HSS.CP.B). This project is a good example of modeling, which is emphasized in the NGSS and the Common Core math standards for high school.

This activity was inspired by two of the disciplinary core ideas in the Next Generation Science Standards: LS3.A (Inheritance of Traits) and LS3.B (Variation of Traits). Our goal was to use Scratch with the Hummingbird to create a genetics simulation. First, we will describe the simplest version of this simulation, and then we will explain how it can be expanded for more advanced students.

This simulation is based on the genetics of eye color. The dominant allele for brown eyes is represented by ‘R,’ and the recessive blue allele is represented by ‘b.’ Scratch is not case sensitive, so we could not use ‘B’ and ‘b’ (because Scratch cannot tell the difference between them). The simulation uses the random number generator to select the allele that a child receives from the mother; this is stored in the variable Gene from Mom. Similarly, the allele that the child receives from the father is stored in Gene from Dad.

Next, an if-else statement is used to determine the color of the child’s eyes. This determines the commands to the Hummingbird and the appearance of the sprite on the screen. On the robot, the servo is used to point to either “Blue Eyes” or “Brown Eyes.” The robot’s eyes turn blue when the simulation indicates that the child has the genotype for blue eyes.

Students learning about genetics for the first time can run the simulation multiple times and count the number of times that the child has blue eyes and brown eyes. They can then change the genotype of the mother and father and repeat this process.  In this way, students can use the simulation to experience how the genotypes of the parents change the probability of a child with blue eyes.

More advanced students can take this simulation further. A loop can be used to run the simulation many times while a variable counts the number of blue genotypes that occur. Again, students can change the genotypes of the parents to measure how that affects the probability of a child with blue eyes.

Students could take this even further! For example, the simulation could start from grandparents instead of parents. In addition, eye color is actually more complicated than the simple Mendelian model used here. The simulation could be modified to include more alleles.