Jump to content

Dice game probabilities: Difference between revisions

m
→‎optimized: undid some wrong edits on the "optimized" REXX version.
m (REXX is to be reviewed)
m (→‎optimized: undid some wrong edits on the "optimized" REXX version.)
Line 1,317:
numeric digits 100 /*increase│decrease for heart's desire.*/
call game 9 4, 6 6 /*1st player: 9 dice, 4 sides; 2nd player: 6 dice, 6 sides*/
say
call game 5 10, 6 7 /* " " 5 " 10 " " " 6 " 7 " */
exit /*stick a fork in it, we're all done. */
Line 1,336 ⟶ 1,335:
end /*j*/
say 'The % probability for first player to win is ' format(winP*100, , 30) "%."
say /* ↑ */
return /*display 30 decimal digits────┘ */
/*──────────────────────────────────────────────────────────────────────────────────────*/
Line 1,345:
do k=n to ns; $=$ p.k; end /*k*/
return $ /* ◄──────────────── probability of 1st player to win, S─sided, N dice.*/</lang>
'''output'''
{{out}}
<pre>
Player 1 has 9 dice with 4 sides each.
Cookies help us deliver our services. By using our services, you agree to our use of cookies.