FlipSite: 5, 6 years of Coin Flip Simulations

I just cleaned up a bug in a golden oldie web site, and it is playing music again. The Interactive FlipSite was created so long ago I cannot remember exactly for sure, at least before 1998. The purpose was to create a site to illustrate simple probability for basic mathematics using the most simple of tools- the odds of flipping coins, and the counting of “heads” and “tails” of the coin flips.

This was one of our “What if?” type projects… a ways back, I met with Scottsdale Community College Math faculty to flesh out an idea he would dream up that we would produce that would make good use of online technologies. john had been doing quite a bit then with graphing calculators, and initially we were thinking of doing some sort of tie in with real world data.


But just in conversation, sitting in his math lab one summer, he just blurted out, “What if we could simulate me flipping coins every 5 seconds for an entire year?” And the idea nicely mushroomed from there.

So while the web site is a bit dated and the graphics of John flipping are rather cheesy, it still works nicely all these years later (well after I fixed a JavaScript related problem John had alerted me too).

It works like this- the site makes it looks like John is flipping a coin in real time, but in reality what we do is to pre-create a giant text file with all 6 million plus coin flips for an entire year ( a bunch of “1”s and “0”s) . The programming feat (perl) was to have the web application (Shockwave) be able to determine the current time (well it is local Arizona time) and then to determine where in that giant array of data we should be. So if I hit the site, on say July 12 at 9:07:50 AM, it finds the location in the array where that data starts, and grabs enough future coin flips for say, another 10 minutes of flips. Shockwave is able to call a perl script to fetch appropriate data as needed. We have another perl script that can regenerate the year of flip data.

It is also able to hit the summary data, e.g. the total of heads and tails up to that point, and generate a running total, so it can let me know that there have been 3,341,614 total flips, where 1,669,175 have been heads and 1,672,439 have been tails.

But watching coin flips does not teach much, that is just the teaser. What John dreamed up and we built were other tools, including:

  • Flip Parade: allows you to see a graphic display of series of flip results for any point in time between January 1 and the current date and time..
  • Flip Streaks: allows you to query how many times, say a streak of 12 heads has occurred in the history of the year. From the results, students can repeat this streak on the Flip Parade, and then they can visually test their assumptions about what follows (some assume there might be a long set of tails, but probability states…. well, you should fill it in).
  • Experiments: using the flip data, you can set up tests to find frequency distributions of coin flips for X number of people each flipping a coin Y times (you enter the X and Y for your own experiments). The site generates a frequency distribution and then students are encouraged to compare the results to the mathematical prediction.

John has used this site regularly since we created it. I set it up and forgot about it ;-)

But it is cool to see that old technology and good ideas can still cook together. Go play:

Profile Picture for Alan Levine aka CogDog
An early 90s builder of the web and blogging Alan Levine barks at CogDogBlog.com on web storytelling (#ds106 #4life), photography, bending WordPress, and serendipity in the infinite internet river. He thinks it's weird to write about himself in the third person.


Comments are closed.