Flipping coins: an activity for introducing computational thinking to non-computer science majors: demonstration
David M. Toth · Journal of computing sciences in colleges · 2010
In this demo, I will present an activity that I use to introduce computational thinking in my non-majors course and outreach talks at high schools. I do this by first talking about what modeling and simulation are and why they are useful. Following this explanation, I introduce a variant of a problem about Alice and Bob. In the original problem, Alice and take turns flipping a coin until one of them gets heads and wins. If Alice goes first, what is the probability that she wins? In class, I introduce this variant of the problem: Bob suggests to Alice that they play a game. They will take turns flipping a coin until one of them wins by getting heads. The winner will then receive a dollar from the loser. If says he will always let Alice go first, should Alice play the game? While this problem is trivial for those comfortable with basic probability and familiar with geometric sequences, most of my students who are not computer science majors are not comfortable with math. Thus, I explain that although the problem can be solved with some math, instead we should first model the problem. Once we have modeled the problem, I have my students get some intuition by pairing off and having each pair play the game 20 times. I collect the results and discuss how so few trials are not sufficient to draw conclusions. Finally, I run a simulation that runs the game one million times and demonstrates that Alice should win 2/3 of the time and thus should play the game.