A coin flipping simulation with games

Start with $. Even money bet on a fair coin. How often do you get to $ before you go broke?

0 && $money < $GOAL_MONEY) { // flip a coin and change our money accordingly. $money += 2*rand(0,1) - 1; // -1 for loss, +1 for win } // track the result if ($money == 0) { $losses++; } elseif ($money == $GOAL_MONEY) { $wins++; } else { echo "Error with playGame() function"; } } ?>

  Number Percentage
Get To $ 0%
Get To $0 0%
Total 100.0%

Games
Starting Money
Goal Money