Skip to main content
  • Curriculum/Education
  • Open access
  • Published:

Evolution in Lego ®: A Physical Simulation of Adaptation by Natural Selection


We describe a physical simulation of natural selection in a population of legorgs, six-segment model organisms. Legorg morphology is genetically specified by five alleles on each segment. Legorgs show a simple form of motility that could evolve in originally sessile animals. This motility, the ability to move horizontally on a smooth surface, depends on the morphology and interaction of the six segments that produce different patterns of locomotion. Legorgs are selected for motility and reproduce in proportion to fitness. After just five generations, the average population motility increases 2.5 times. Additionally, we describe a slightly less time-consuming simulation of legorg evolution, where fitness is assigned by comparison with a template. The calculation of gene pools is precisely the same as in the previous simulation and produces very robust increases in fitness during five generations. The simulation is designed as a classroom experiment to explore the mechanism of natural selection. A test of its learning efficiency by evaluating the students’ conception of central aspects of evolutionary theory before and after showed a significant improvement. The surprising power of natural selection in this very simple physical system may also be exploited in more advanced experiments.


“Nothing in biology makes sense except in the light of evolution” (Dobzhansky 1973)—yet evolution is also one of the most misunderstood topics of biology (Linhart 1997), and even biology majors’ understanding is severely hampered by misconceptions (Nehm and Reilly 2007). For example, outside the sphere of professional biologists, it is often overlooked that the current theory of evolution is partly a history of life and the relationship of all living organisms and partly precise, proximate mechanisms of evolutionary change. These mechanisms are primarily the theory of natural selection as formulated by Darwin (1859), but also include various non-adaptive mechanisms such as genetic drift. The description of the history of life is based on data from paleontology, comparative anatomy, and molecular biology, but the historical theory and the mechanisms are not necessarily linked. For example, life could have arisen several times but still evolve according to the principles of natural selection—or the mechanism of natural selection could be too simplistic to account for the process of evolution, and evolutionary history itself (and mechanisms such as random variation due to genetic drift, for example) could be equally important for the outcome of the evolutionary process. Much of the current debate in evolutionary theory (see, e.g., Dawkins 1986; Gould 2002; Freeman and Herron 2004) focuses on the relative importance of natural selection and random events in evolution history to the course of evolution. Thus, it would be valuable to assess the importance of natural selection for demonstration purposes, since, as shown by Nehm and Reilly (2007), such active learning is much more efficient than more traditional learning methods (lectures).

Whereas life’s relatedness in principle can be demonstrated by comparative anatomy, studies of the fossil record, and analyses of genetic data, it generally is difficult to demonstrate mechanisms of evolution in classroom exercises except in simulation experiments, which can either be physical—usually using different colored objects symbolizing different alleles—or virtual—using computer models. Recent physical simulation experiments have focused on mechanisms of genetic drift (Staub 2002) and predation and selection mechanisms (directional, disruptive, and stabilizing selection; Lauer 2000). In these simulations, only one gene is represented by using different colored objects (M&Ms or jellybeans). Apart from a physical demonstration of successive adaptation using dice and the game of Yahtzee® (Dickinson 1998), teachers are mostly resorting to computer modeling for demonstrations of adaptation by natural selection, for example, based on genetic algorithms (for an introduction to genetic algorithms, see Michalewicz 1996). Of such virtual simulations, a famous computer model is the “weasel” algorithm, where model organisms are sequences of letters that are changed over generations by selection against a template (Dawkins 1986). Another computer simulation, also by Dawkins (1986), traces the evolution of “biomorphs,” organisms that have a small genome (nine genes) where each gene specifies a developmental branching rule that is applied recursively. The experimenter assigns fitness to the biomorphs, e.g., based on shape or other features. The experiments show conclusively that very complex and diverse organisms can result from a small set of developmental rules. One really interesting feature of both the weasel and biomorph simulations is that they simulate the effects of several genes (in contrast to the physical simulations mentioned above). Both simulations really demonstrate artificial selection since fitness is assigned explicitly and only the animals with highest fitness are allowed to breed.

Software using digital organisms (self-replicating computer programs)—a complete simulation in which both the replication and metabolism of (simple) organisms are simulated—is a promising field in the teaching of evolutionary biology (Wilke and Adami 2002). A recent, very sophisticated simulation platform is the Avida software, where both changes in fitness and the evolution of complex features can be investigated over thousands of generations (Lenski et al. 2003). However, the software available presently is probably too advanced for introductory classes in evolutionary biology. It may be hoped, though, that simplified versions will be created for teaching purposes; such software would be immensely instructive.

In contrast, for practical reasons, physical simulations cannot cover many generations but have the advantage that the actual calculations are directly visible to the student, and in our opinion, a simple physical simulation may therefore be more convincing and “lifelike” and therefore more efficient than a virtual simulation. To demonstrate the power of natural selection in a physical simulation experiment, we have developed a student practical that incorporates all elements of the algorithm but nevertheless is performed on physical entities (plastic Lego® bricks) with all calculations done by the students. We chose the Lego® bricks because “animals” can be constructed from them, and while they are not edible, they have the advantage of being reusable and washable! We describe first a simulation based on selection for motility and then a slightly less time-consuming, template-based selection. Only the assignment of fitness is different in the two cases. The simulations are designed as a two-hour classroom experiment.

We used legorgs, six-segment animals constructed from Lego® bricks. Each of the upper five segments was coded by a gene with five different alleles (the color of the brick). Each allele specified a morphogenetic rule—how the segment is placed on the previous segment (Table 1 and instruction video at Thus, genetic variation produced legorgs with different morphologies. A population of legorgs was drawn at random from the gene pools, for practical reasons one pool for each gene, and constructed according to the morphogenetic rules. The fitness of the legorgs was scored by measuring their simulated motility, defined as the horizontal distance the legorg had moved on a hard, smooth surface after being released and righted on its foot segment again. This motility can be thought of as a very primitive type of motility evolved in an originally sessile animal. In other words, stable legorgs do not reproduce, and animals are selected for a morphology that maximizes the horizontal distance traveled. Each legorg’s contribution to the next generation’s gene pools was weighted by its fitness, and the new generation was drawn from the resulting gene pools. The experiment continued for five generations.

Table 1 Morphogenetical rules in experiment 2 (all bricks are 4 × 2 bricks, dimensions 32 × 16 × 9 mm)

For template-based selection simulation, legorgs constructed from five Lego® bricks were first drawn at random from a gene pool (simulating random mating) and placed on fixed, identical foot bricks. They were assigned a fitness score by comparison with a model or template animal. Then, each animal’s contribution to the next gene pool was adjusted by its fitness, the next gene pool is constructed, and the next generation is drawn. The exercise continues for five generations.

We have been using this exercise for several years in an undergraduate introductory biology class, but it could also be used in high school since no advanced level of calculus is needed.


Experiment 1

The legorgs are constructed from six 4 × 2 Lego® bricks (dimensions 32 × 16 × 9 mm). Brick 1, the foot segment, is fixed. Each of the five upper segments, however, is coded by a gene with five alleles symbolized by five colors. Each allele corresponds to a morphogenetic rule stating how the segment should be placed on the previous brick (see Table 1). During construction, the animal is turned counterclockwise after placing one of the transverse segments (i.e., yellow, white, or black alleles). Each segment is drawn from a gene pool (plastic bag) containing 100 bricks with an initial random distribution of alleles. We have one gene pool for each segment, and at the start of the experiment, each gene pool contains 20 bricks of each color.

After noting the configuration of the animals in a generation table (and returning the bricks after each draw), the animals are built. We have only drawn ten animals per generation in this experiment to fit the experiment in a two-hour frame. The morphogenetic rules (Table 1) produce legorgs of different shapes (see, e.g., examples in Fig. 3). Depending on the shape, the legorgs will be more or less stable when placed on the foot (brick 1). They are scored on their motility, defined as how far they will move when righted on the foot and released on a hard, smooth surface, for example, a whiteboard plate. When measuring the distance moved, we right the legorg on the foot again and measure the linear distance that one of the corners of the foot has been translated. The score is the average of five trials. Stable legorgs will have a score of zero. After scoring the animals, the next generation gene pools are calculated. In this calculation, the alleles of each animal is weighed by the ratio of the animal’s fitness to the summed fitness of the population (i.e., by the relative fitness). The composition of the next generation gene pools can be calculated using the gene pool tables (example in Table 3): For each gene pool, the number of bricks of each color is calculated by multiplying the relative fitnesses by 100. Then the bags are filled accordingly, and the students are ready to draw the next generation.

It is important to note that although the alleles are represented by the same five colors on the five segments and the same color represents the same morphogenetic rule across segments, alleles are functionally independent (producing different effects on fitness depending on segment number) and selected independently across segments (since there is a separate gene pool for each segment).

Experiment 2 (Template Selection)

Again, we use 4 × 2 Lego® bricks (dimensions 32 × 16 × 9 mm) of five different colors. The legorgs are constructed from five bricks (segments), and each segment is coded by a gene that has five alleles (colors). The model animal is constructed by the students. We have made the practical constraint that all colors should be different in the model animal to avoid all gene pools converging on one color and exhausting the supply of bricks (our stock is 500 bricks of each color, i.e., 2,500 in all, which usually is sufficient for two to three concurrent student teams). The students construct gene pools for each of the five genes. The gene pools consist of 100 bricks held in five opaque bags. At the start of the experiment, each gene pool contains 20 bricks of each color.

An animal is constructed by drawing a brick at random from each of the gene pools. The students then note the configuration in the generation’s table (Table 2) and return the bricks to the respective gene pools. After drawing 20 animals, each animal is scored against the model. Segments where alleles match the model get a score of one, so the resulting fitness of the animal ranges from zero to five, with five being a complete match). The animal’s genes contribute to the next generation’s gene pool according to the ratio of the animal’s fitness to the summed fitness (i.e., by its relative fitness). Thus, the composition of the next generation’s gene pools can be calculated using the gene pool table (Table 3, bottom row): For each gene pool, the number of bricks of each color is calculated by multiplying the relative fitnesses by 100. Then the bags are filled accordingly, and the students are ready to draw the next generation.

Table 2 Generation table
Table 3 Gene pool table

The experiment continues for five generations, and the main result is the growth of mean population fitness with generation. The experiment lasts for approximately two hours.

To demonstrate the effects of larger animals (100 genes), larger population sizes, and many generations of selection, we have implemented the simulation in experiment 2 (i.e., fitness assigned by comparison with a template) in custom-made computer simulation software that can be used in connection with the physical simulation.

The simulation software as well as empty tables for fitness scoring and instructional video clips can be downloaded from our home page (


The student results from experiment 1 are shown in Fig. 1. We generally see an increase of mean population fitness with generation (for all trials, mean population fitness is increased by 2.5 times in five generations), but the outcome of the individual five-generation trials vary considerably. Part of this variation is probably caused by the small population sizes and the initial population configuration, but additionally, the different evolution histories can produce legorgs with very different morphology (but equally high fitness). Examples are shown in Fig. 2. The figure shows five fifth-generation legorgs, each from a different trial. The legorgs shown are maximum likelihood organisms, formed by taking the most common allele in each gene pool.

Fig. 1
figure 1

Mean population fitness as a function of generation in experiment 1. Fitness is calculated as the average distance moved by the animals, measured using the procedure described in “Methods”. The figure shows data from 22 trials (different symbols for each trial)

Fig. 2
figure 2

Maximum likelihood animals after five generations of selection in experiment 2. Each animal was constructed according to the morphogenetic rules (see Table 1) by combining the most common allele of fifth-generation gene pools 1–5. The five animals represent the outcome of five different trials. Drawing by Nina Krogh

The results of experiment 2 are shown in Fig. 3. In all cases, we have seen an increase of fitness with generation. In comparison to the data from experiment 1, the increase in fitness is more robust in this experiment. There is still variation between trials, however, reflecting the effects of the small population size (i.e., genetic drift).

Fig. 3
figure 3

Mean population fitness as a function of generation in experiment 2. Fitness is calculated as the match with a template and ranges from 0 to 5. The figure shows all data from the student labs (34 trials)

The template-based experiment is easy to simulate on a computer, which allows testing of larger population sizes, genomes, and generation span. In the example in Fig. 4, the evolution of a 100-gene, 1,000-individual legorg population is simulated for 100 generations, showing a relatively smooth fitness increase with generation. The software also allows inspection of the gene pools from generation to generation.

Fig. 4
figure 4

Fitness as function of generation in a simulation experiment. Experiment 2 is computer-simulated for 100-gene animals over 100 generations. The fitness is normalized (1 is the maximum). The population size is 110, and the dots represent a random subsample of the population to show the variation. The solid line is the average fitness

The efficacy of the practical was evaluated by letting the students (the whole class, i.e., approximately 180 students) do a short test (seven multiple-choice questions on the mechanism of natural selection and adaptation and on population genetics) before and after the practical. The students were not allowed to discuss their answers before the final test. The questions were in Danish, and a translation is shown in Table 4. The evaluation of the responses showed a highly significant improvement of the test score after the practical (Wilcoxon two-sample test, one-sided, p = 0.0011).

Table 4 Test for evaluation of the lego practical


The mean population fitness in both experiments 1 and 2 increases with generation (Fig. 1), and there is clear adaptation within just five generations in all student labs, showing that adaptation by natural selection is a robust, demonstrable mechanism. In experiment 1, five generations of selection increase the population mean fitness by 2.5. However, the outcome of the individual trials, both in terms of mean fitness and animal shapes, varies considerably and is strongly dependent on the initial population and therefore on genetic drift in these very small populations. Additionally, in this simulation, there is not one well-defined best solution. Rather, the legorgs evolve different locomotion types, as it may be gauged from the different morphologies in Fig. 3. It is instructive to compare the different teams’ generation-5 animals (Fig. 3) and gene pools since they will have different configurations and directly show the effect of genetic drift—also in some cases leading to loss of “valuable” alleles. Analysis of the results could lead to a discussion of the outcome of evolution as interplay between random events and selection pressures.

In experiment 2, it is very instructive to watch the gene pools converge toward the “solution”. Usually, after five generations, one or more of the gene pools are dominated by one allele. That allele is not necessarily the “correct” allele; due again to “genetic drift,” the small population size (ten or 20 animals) can lead to extinction of some of the correct alleles, and then the maximum adaptation (fitness of 5) is unattainable. It is obvious that both experiments 1 and 2 represent an extreme simplification of the mechanism of natural selection. For example, in these five-gene animals, the changes in fitness by adaptation in one gene is much larger than it would be in a ten-gene animal, and the larger the animal, the more generations are needed to see an effect. We have made a computer program to simulate the exercise in animals with more genes (Fig. 2), and we recommend using a computer simulation to demonstrate the effects of added complexity. In the discussion of the practicals, we always emphasize the simplifications inherent in the model and especially the fact that strong adaptation can lead to loss of genetic variation.

In our experience, it is initially surprisingly difficult for the students to realize that fitness is a property of the whole animal—i.e., that an allele can get a high weight, even if it is not correct (in experiment 2), if the animal has a high fitness, i.e., has many other adapted genes. It is a major goal of the exercise to illustrate this important point. Another obstacle is that students may confuse the gene (i.e., the segment on the animal) with the allele because the same type of bricks is used for all genes. This is confusing since the effect of an allele on fitness, both in experiments 1 and 2, is segment specific. It might be preferable that the shape of the bricks would be different for each segment, which is surely possible given the variety of bricks available, but also more impractical (25 instead of five different sorts).

The only difference between experiments 1 and 2 is the way fitness is assigned. Here, experiment 1 is clearly the most naturalistic. The simple “motility” defined in the experiment could even be seen as a primitive form of motility in an originally sessile animal, which can only detach or attach itself to the substrate. In experiment 1, there is no well-defined solution, and it is likely that several configurations will increase the fitness. In contrast to experiment 2, the development of fitness per generation does not progress as smoothly in experiment 1. This is due to the increased complexity (and realism) of the model, notably the interaction of the genes (epistasis), as described previously. Furthermore, the genes are not independent, since high fitness will depend on certain combinations of alleles that affect the stability of the animal. For example, an animal consisting only of blue alleles (all bricks exactly on top of each other) will be inherently stable and have zero fitness. If one of the “lower” genes is changed, the animal will have non-zero fitness, whereas if the “top” gene is changed, the animal will keep its stability (i.e., maintain zero fitness). Because of this added complexity, it may be necessary to allow more generations than five; however, we usually see a consistent increase in fitness with generation. However, even if generally experiment 2 may be more straightforward and practical, experiment 1 in our experience is much more appealing to the students and less conceptually confusing since it avoids the idea of an end goal of evolution.

In the discussion of the practical, it should be emphasized that evolution does not work progressively toward an ideal organism. On the other hand, there are certainly functional aspects of biological systems that have a limited number of attainable, optimal solutions converged upon by the selection mechanism, and those instances do result in convergent evolution, such as the classical examples of shapes of fast-swimming animals. To what extent convergence based on environmental selection has shaped the course of evolution, especially in the design of body plans, has been the topic of the Gould/Conway Morris debate about contingency in evolution (Conway Morris 1998; Gould 2002).

The simulation could be extended in several directions, for example:

  1. 1.

    The selection model could be changed after a number of generations to exploit the disadvantages of too strong adaptation (i.e., loss of genetic variation).

  2. 2.

    All animals with non-zero fitness reproduce. The fitness threshold can be changed, so only animals with, e.g., fitness above 2 will reproduce (this would increase not only the speed of the initial phase of the exercise but also the risk of extinction or of an early loss of a “good” allele).

  3. 3.

    Mutations can be introduced by exchanging one or more bricks in the gene pools by different (random) colors (note that mutation rates will be fairly high—(at least 0.01), unless the size of the gene pools is changed).

  4. 4.

    Bottleneck effects can be exploited by comparing the evolution of populations of different sizes (for example five, ten, 20, and 40 animals).

  5. 5.

    An increase or decrease in complexity of the animals (experiment 1) can be introduced by adding or removing segments. It would be possible to make a set of morphogenetic rules where one allele was an extension allele (as in Dawkins 1986). Probably, there should be a penalty (increased energy expenditure) for increasing the complexity, calculated by downscaling the fitness by a factor. Similarly, another allele could be a reduction allele (where the fitness would be scaled up by a factor). It would probably make most sense to regard extension/reduction as speciation events and construct separate gene pools for the new species. However, in this case, the practical becomes a lot more complicated. Thus, this option probably works best as an individual student project, but the option does show that there are lots of possibilities, also of rather sophisticated simulations, in this practical.

  6. 6.

    As an alternative or supplement to the “naturalistic” assignment of fitness in experiment 1, “camouflage” against a colored background could also be used—using differently colored backgrounds, a video camera, and appropriate software to detect figure-ground contrast.

It may be worthwhile after the practical to discuss some of the real-world examples of (rapid) adaptation by natural selection, which have been demonstrated in some cases where selection pressures have been changed in drastic but well-documented ways. The adaptive effects of selection have been demonstrated in the changes in beak morphology in Darwin’s finch populations following a disastrous drought year (reviewed in Grant 1999). As argued by Elena and Lenski (2003), microorganisms provide ideal organisms for experimental investigations of evolutionary processes. For example, Oliver et al. (2000) report increased frequency of hypermutable Pseudomonas aeruginosa strains in response to chronical antibiotic treatment in cystic fibrosis patients. A fascinating experiment, where Escherichia coli populations (constructed from single clones, i.e., initially genetically identical) were studied for 10,000 generations, showed rapid adaptation (increase in fitness, i.e., relative growth rate compared to the ancestor) during the first 2,000 generations followed by near stasis. The fitness increase is generated by major beneficial mutations that spread through the population until saturation (the near-stasis phase); subsequent beneficial mutations will lead to a renewed fitness increase (Lenski and Travisano 1994, see also review by Elena and Lenski 2003). In our view, one might interpret these results as showing that selection is such a powerful mechanism that whenever there is a large selection pressure, it does adapt the population rapidly—and it will therefore be difficult to demonstrate in natural populations.

In conclusion, the described experiments provide simple, practical demonstrations of the central mechanisms in evolution—natural selection and genetic drift. We have been using both experiments 1 and 2 in student labs and found both to be robust and illustrative, showing that adaptation by natural selection is a powerful and robust mechanism, but that random variation also influences the course of evolution. As an example of active learning (Nehm and Reilly 2007), we have shown that the practical improves the students’ understanding of the fundamental principles of natural selection. We hope that it can contribute in furthering the appreciation of evolution as the scientific foundation of modern biology.


Download references


We thank Henrik H. Lund, Maersk Institute, University of Southern Denmark for providing the Lego® bricks; Annemarie Surlykke and Paolo Sibani for comments on an earlier version of the manuscript; and Nina Krogh for drawing the Lego® animals.

Author information

Authors and Affiliations


Corresponding author

Correspondence to Jakob Christensen-Dalsgaard.

Rights and permissions

Open Access This is an open access article distributed under the terms of the Creative Commons Attribution Noncommercial License ( ), which permits any noncommercial use, distribution, and reproduction in any medium, provided the original author(s) and source are credited.

Reprints and permissions

About this article

Cite this article

Christensen-Dalsgaard, J., Kanneworff, M. Evolution in Lego ®: A Physical Simulation of Adaptation by Natural Selection. Evo Edu Outreach 2, 518–526 (2009).

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: