Re: Bridge anyone? [not off topic]
Re: Bridge anyone? [not off topic]
- Subject: Re: Bridge anyone? [not off topic]
- From: Bernard Bernu <email@hidden>
- Date: Mon, 8 Nov 2004 10:57:46 +0100
Le 8 nov. 04, à 06:28, David Andrews a écrit :
Nigel,
I thought it was determined a while back that Randomly choosing hands to fill will result in the last hand to fill having a high probability of a run of low clubs.
All scripts I sent were wrong and result with bad hands as you, Emmanuel and kai (last mail) have pointed.
BUT Nigel algorithm is absolutely correct and it is only 50% slower than the non sorted one.
Verification : calculate the probability for each hand to get each card : this probability is 1/4
for 10000 deals, on should get in average 2500 times each cards in each hand.
Standard deviation should be sqrt(10000)
I added the following lines to Nigel script:
chrono
property handstat : {}
repeat with i from 1 to 52
set end of handstat to 0
end repeat
copy handstat to easthand
copy handstat to northhand
copy handstat to westhand
copy handstat to southhand
repeat 10000 times
set {east, north, west, south} to deal()
repeat with i from 1 to 13
set j to item i of east
set easthand's item j to (easthand's item j) + 1
set j to item i of north
set northhand's item j to (northhand's item j) + 1
set j to item i of west
set westhand's item j to (westhand's item j) + 1
set j to item i of south
set southhand's item j to (southhand's item j) + 1
end repeat
end repeat
chrono
The results for each hand and each card is Attachment:
bridge.pdf
Description: Adobe PDF document
EAST NORTH WEST SOUTH
2519.0000 2526.0000 2520.0000 2435.0000
2510.0000 2484.0000 2544.0000 2462.0000
2557.0000 2566.0000 2493.0000 2384.0000
2445.0000 2521.0000 2519.0000 2515.0000
2452.0000 2489.0000 2489.0000 2570.0000
2465.0000 2577.0000 2469.0000 2489.0000
2594.0000 2543.0000 2452.0000 2411.0000
2497.0000 2531.0000 2436.0000 2536.0000
2528.0000 2436.0000 2550.0000 2486.0000
2471.0000 2481.0000 2539.0000 2509.0000
2504.0000 2506.0000 2527.0000 2463.0000
2597.0000 2430.0000 2462.0000 2511.0000
2480.0000 2450.0000 2468.0000 2602.0000
2559.0000 2454.0000 2479.0000 2508.0000
2469.0000 2495.0000 2571.0000 2465.0000
2569.0000 2547.0000 2368.0000 2516.0000
2525.0000 2412.0000 2547.0000 2516.0000
2463.0000 2600.0000 2484.0000 2453.0000
2499.0000 2502.0000 2530.0000 2469.0000
2525.0000 2494.0000 2523.0000 2458.0000
2492.0000 2483.0000 2477.0000 2548.0000
2562.0000 2468.0000 2476.0000 2494.0000
2547.0000 2459.0000 2505.0000 2489.0000
2537.0000 2486.0000 2524.0000 2453.0000
2521.0000 2503.0000 2516.0000 2460.0000
2519.0000 2495.0000 2502.0000 2484.0000
2449.0000 2508.0000 2575.0000 2468.0000
2439.0000 2537.0000 2475.0000 2549.0000
2511.0000 2469.0000 2520.0000 2500.0000
2423.0000 2549.0000 2524.0000 2504.0000
2517.0000 2391.0000 2546.0000 2546.0000
2466.0000 2488.0000 2467.0000 2579.0000
2462.0000 2530.0000 2505.0000 2503.0000
2505.0000 2465.0000 2539.0000 2491.0000
2514.0000 2508.0000 2452.0000 2526.0000
2479.0000 2523.0000 2546.0000 2452.0000
2460.0000 2511.0000 2453.0000 2576.0000
2559.0000 2483.0000 2464.0000 2494.0000
2433.0000 2540.0000 2560.0000 2467.0000
2561.0000 2534.0000 2417.0000 2488.0000
2483.0000 2450.0000 2517.0000 2550.0000
2529.0000 2471.0000 2616.0000 2384.0000
2397.0000 2499.0000 2530.0000 2574.0000
2482.0000 2551.0000 2425.0000 2542.0000
2499.0000 2570.0000 2406.0000 2525.0000
2475.0000 2475.0000 2496.0000 2554.0000
2522.0000 2529.0000 2452.0000 2497.0000
2516.0000 2417.0000 2554.0000 2513.0000
2487.0000 2541.0000 2503.0000 2469.0000
2440.0000 2535.0000 2501.0000 2524.0000
2485.0000 2481.0000 2491.0000 2543.0000
2501.0000 2507.0000 2496.0000 2496.0000
Thoose numbers are indeed around 2500.
Their standard deviation are
41.166640714203, 43.224814810299, 38.730329995218,45.098609905236
I don't know how to calculate the theoretical value of this stdev, it is different of sqrt(2500) because of the correlations (all cards are distributed).
Bernard
On Nov 6, 2004, at 8:44 PM, Nigel Garvey wrote:
... on deal()
script o
property chances : {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, ¬
14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, ¬
27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, ¬
40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52}
property hands : {{}, {}, {}, {}}
end script
repeat with i from 1 to 52
set c to some integer of o's chances
set item c of o's chances to missing value
set end of item ((c - 1) mod 4 + 1) of o's hands to item i of my
deck
end repeat
return o's hands
end deal
...
This may be a bit unusual, but the odds...
after about a half dozen deals:
{{"9❺", "8❺", "2❺", "Q❸", "10❸", "5❸", "2❸", "A❹", "Q❹", "2❹", "A❻", "K❻", "9❻"}, {"7❺", "3❺", "J❸", "9❸", "7❸", "6❸", "3❸", "K❹", "J❹", "9❹", "8❹", "10❻", "6❻"}, {"A❺", "K❺", "A❸", "K❸", "8❸", "7❹", "6❹", "3❹", "J❻", "5❻", "4❻", "3❻", "2❻"}, {"Q❺", "J❺", "10❺", "6❺", "5❺", "4❺", "4❸", "10❹", "5❹", "4❹", "Q❻", "8❻", "7❻"}}
two more deals:
{{"5❺", "3❺", "2❺", "A❸", "8❸", "4❸", "A❹", "10❹", "9❹", "5❹", "4❹", "Q❻", "J❻"}, {"K❺", "J❺", "9❺", "7❺", "4❺", "Q❸", "10❸", "7❸", "K❹", "8❹", "6❹", "8❻", "6❻"}, {"A❺", "8❺", "6❺", "K❸", "J❸", "9❸", "3❸", "2❸", "Q❹", "J❹", "3❹", "K❻", "7❻"}, {"Q❺", "10❺", "6❸", "5❸", "7❹", "2❹", "A❻", "10❻", "9❻", "5❻", "4❻", "3❻", "2❻"}}
David A
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
________________________________________________________________________
Bernard Bernu | Internet : email@hidden.
Physique Theorique des Liquides | http://www.lptl.jussieu.fr/users/bernu
4, place Jussieu, Tour 16, Et. 5 | Tel : (33) 01 44 27 72 38
Boite 121 | Fax : (33) 01 44 27 51 00
75252 Paris Cedex 05, France
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden