In this project, you will create an experimental probability calculator. Mathematics tells us that the probability of getting heads when flipping a coin is 50%--that's theoretical probability. However, when we count our coin flips, the probability seems to change with time--that's experimental probability. You'll build an app to show this and learn some great programming concepts along the way!

Play this demo in full screen.

1) Use an online graphics editor (piskelapp.com was used to create graphics for this project) to create a button graphic that the user will click to flip a coin. Upload that graphic and position it somewhere on the screen.

Play this demo in full screen.

2) Create similar graphics that will sit next to the calculations for the number of heads, number of tails, probability of heads, and probability of tails.

Play this demo in full screen.

3) Create two text sprites to hold the total number of heads and tails counted so far. Create variables to hold those numbers and have that value display in the text. Start the number at 0.

Play this demo in full screen.

4) When the flip coin button is pressed, add 1 randomly to the number of heads and tails.

Play this demo in full screen.

5) Calculate the experimental probability of heads and tails based upon the number of coin flips done so far and update it as the number of flips continues.

Play this demo in full screen.

6) Create two graphics: one for heads of your coin, and one for tails. Make a sprite appear with the appropriate graphic on each coin flip. You will need a way to alter these sprites later.

Play this demo in full screen.

7) Make the first coin appear on the upper left of the screen. Make each additional coin appear to the right of the previous one.

Play this demo in full screen.

8) When the coins get to the end of a row, have the coins start on the next row.

Play this demo in full screen.

9) When the coins fill up the screen, have the coins clear and restart the coins on top.

Play this demo in full screen.

10) Want the program to be a game? Find someone near you and play Penny's game. One player picks a sequence of heads and tails and shows it to the other player. The second player makes a sequence of the same length. Use your coin flipper app and the player whose sequence shows up first wins.