// Make projections for a player, given their total is already sum,// Value to beat is beat, their player number is player, and// players is the total number of players.
makeProjections[sum, beat, player, players] :=
{
spin = projSpin[sum, beat, player, players]
stay = projStay[sum, beat, player, players]

// Return probability that you'll beat the value// given by beat. This should only be called for the last player.
spinToBeat[beat, val=0, spinNum=1] :=
{
if beat > 100
return 1 // Other guy busted, you win

if val > beat
return 1 // Don't spin... you've won.

if spinNum > 2 // You have no more spins
if val == beat
return 1/2 // Tie
else
return 0 // Lost