Last week I introduced you to my escape room/dungeon crawling/superhero training simulation and a few basic results. I don’t want to keep all the fun for myself, so now it’s your turn. I like being able to program so I can make little models and simulations and get “hands-on” with equations and abstract concepts. Some people can look at an equation and understand how changing different parameters will change the results. If there are just two variables, a graph might work. But if there are additional variables or parameters, I find it helpful to make an interactive graph with sliders for the different parameters. Nowadays you can just go to Desmos and get that kind of interactivity, but when I was a student I had to write the programs myself.
Interactive graphs work well for models with analytical equations and a few parameters. As models get more complex and stochastic, simulations can serve a similar purpose. They provide an opportunity to play around with the model and see what happens under different conditions. Playing in this fashion helps to build intuition for how the model works. I want to give you a chance (hopefully many chances over time) to play with my evolutionary escape room simulation to get a feel for how evolution works and doesn’t work. So step into my Quandary Den. (Follow this link if the embed below is too small or does not work.)
You can check out last week’s post for details on what is being simulated. Basically, one player has to score points against four opponents to solve the room. Their actions are determined by a series of instructions (a gene or genome) that changes from one generation to the next to evolve better solutions. To get you started on playing and learning and experimenting, I’ve given you a few variables to control.
- Generations: You can choose how many generations of evolution to simulate. More generations typically gives more time to find better solutions, but involves more computation. You may need to experiment to see what will run on your computer in a reasonable amount of time.
- Genome Length: You can choose how long the genome of the player is, or how many total instructions they can carry out in one generation. Each instruction has two parts, an action and a direction, so the total number of instructions is half the genome length. In other words, if the genome length is 128, the player has 64 total steps to solve the room.
- Mutation Rate: You can choose how often mutations occur, expressed as the probability of mutation per genome site per generation. For example, if the genome length is 100 and the mutation rate is 0.01 (1.00e-2), on average there will be one change per generation. If the mutation rate is 0.5, on average half of the genome locations will change per generation.
- Team: You can choose whether the player is a Zapper or a Tagger. A Zapper has a laser gun and can zap opponents from a distance to score points. Taggers have to get next to an opponent to tag them and score points.
Once you choose the conditions of your experiment, press “Begin!” In the background, your computer will go through however many generations of evolution you indicated. It will not show each individual generation on screen. Instead, it will start animating the player solution from an early generation, then when that’s done animate the currently available generation and so on until the end. Finally, it will animate the best solution it found, then provide a link to download a movie of that animation if you’d like to save it. Underneath the animation, there will be stats about the current generation being evaluated and the best solution found so far. The best possible fitness is 10.
Last week I posed a question about whether there’d be a difference in how zappers and taggers evolve. If you have a hypothesis, here’s your chance to test it. Or you can explore other hypotheses about how mutation rate or genome length or number of generations impacts the results. Feel free to try whatever experiments you’d like. Then share your hypotheses, experimental design, and results in the comments below.
Andy has worn many hats in his life. He knows this is a dreadfully clichéd notion, but since it is also literally true he uses it anyway. Among his current metaphorical hats: husband of one wife, father of two teenagers, reader of science fiction and science fact, enthusiast of contemporary symphonic music, and chief science officer. Previous metaphorical hats include: comp bio postdoc, molecular biology grad student, InterVarsity chapter president (that one came with a literal hat), music store clerk, house painter, and mosquito trapper. Among his more unique literal hats: British bobby, captain’s hats (of varying levels of authenticity) of several specific vessels, a deerstalker from 221B Baker St, and a railroad engineer’s cap. His monthly Science in Review is drawn from his weekly Science Corner posts — Wednesdays, 8am (Eastern) on the Emerging Scholars Network Blog. His book Faith across the Multiverse is available from Hendrickson.