exupero's blog
RSSApps

Animated penny game

The posts in this series on the penny game is only the latest (and simplest) version of the simulation I've written. The original version was implemented in Python and included a visual representation of each scenario and each station's backlog of pennies, updating as the state changed.

That version was a good starting point, but viewers found it hard to track the changes happening, especially when the simulation ran and the backlogs rapidly changed. Also, being in Python, it was a little harder to distribute for people to run on their own. As a result, the next version was JavaScript-based so it could be run in anyone's browser, and it included animations of pennies moving from station to station. You can find that version here.

Both the Python and browser versions were intended for use in a presentation, so neither UI included any explanation of what was going on; that was the job of the presenter. In the online version, you can find some controls by hovering over the blue handles on the left.

If you click "Run", the will simulation start start slowly and show pennies dropping from one station to the next as they're processed. After a few steps the animations will speed up. Eventually it will run even faster and stop showing the pennies drop.

Clicking "Show graphs" will show some statistics comparing the different scenarios. One difference between the animated version and the logic in this series is evident in the "Days to Delivery" graph. Here, we tracked how much time every penny spent in the system. In the animated version, I only tracked one penny in each scenario, marked with a black dot. When those pennies reach the end of their respective lines, a new penny with a dot was added at the beginning of the line. The "Days to Delivery" graph shows how long each of those pennies took to get through the entire line. While a dotted penny is stuck in backlogs, there's no new data about completion time, so as the graphs have long flat sections. For the scenario with inputs constrained to the bottleneck and faster turnover, data comes more frequently.

When graphs are shown, there's one additional feature I didn't repeat on this blog: you can click "Average" and run several more simulations very quickly to see the general behavior of each scenario, rather than the results of one specific randomized run.

Finally, you can also provide a number with which to seed the simulation's random number generator by including an integer after the # in the URL and reloading the page. Using the same seed, the dice will roll the same sequence of numbers, which allows you to run the simulation repeatedly and get the same results.

If you have any questions, comments, or suggestions about the penny game, feel free to email me.