Two Plus Two Older Archives  

Go Back   Two Plus Two Older Archives > General Gambling > Probability
FAQ Community Calendar Today's Posts Search

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 08-13-2005, 01:45 PM
pzhon pzhon is offline
Member
 
Join Date: Mar 2004
Posts: 66
Default Re: Options - Related Question

Recursive Mathematica code:

Clear[gamevalue];
gamevalue[black_, white_] :=
gamevalue[black, white] =
If[black == white == 0 || black < 0 || white < 0, 0,
Max[0, black/(black + white) (-1 + gamevalue[black - 1, white]) +
white/(black + white) (1 + gamevalue[black, white - 1])]]

Badly formatted output:

Table[gamevalue[i, j], {i, 0, 10}, {j, 0, 10}]

0 1 2 3 4 5 6 7 8 9 10
0 1/2 4/3 9/4 16/5 25/6 36/7 49/8 64/9 81/10 100/11
0 0 2/3 3/2 12/5 10/3 30/7 21/4 56/9 36/5 90/11
0 0 1/5 17/20 58/35 71/28 145/42 527/120 294/55 347/55 1041/143
0 0 0 12/35 1 113/63 93/35 235/66 202/45 777/143 492/77
0 0 0 0 4/9 47/42 21/11 199/72 428/117 705/154 182/33
0 0 0 0 1/15 127/231 284/231 3457/1716 8594/3003 5356/143 1333/286
0 0 0 0 0 61/396 563/858 4583/3432 13606/6435 8449/2860 9319/2431
0 0 0 0 0 0 697/3003 49/65 18457/12870 53683/24310 133097/43758
0 0 0 0 0 0 0 311/1040 10224/12155 74131/48620 106045/46189
0 0 0 0 0 0 0 0 7793/21879 84855/92378 26995/16796
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:13 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.