ballgame.frink

View or download ballgame.frink in plain text format


// Program to solve for probabilities of a specific game.

s = 0

for i=0 to 100
   s = s + i

pe1 = s / 101

println["Projected earnings: " + pe1]

s = 0
for i=0 to 100
{
   if i < pe1      // If projected earnings are less than you'd get from a
      s = s + pe1  // new ball, draw a new ball.
   else
      s = s + i    // Otherwise take it.
}

pe2 = s / 101
println["Projected earnings: " + pe2]

s = 0
for i=0 to 100
{
   if i < pe2
      s = s + pe2
   else
      s = s + i
}

pe3 = s / 101
println["Projected earnings: " + pe3]


View or download ballgame.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 17591 days, 17 hours, 38 minutes ago.