Finess bias in the random hand generator
#1
Posted 2014-December-12, 12:19
#2
Posted 2014-December-12, 13:05
https://www.youtube....hungPlaysBridge
#3
Posted 2014-December-12, 13:59
#4
Posted 2014-December-12, 15:32
I assure you that nothing is done in the BBO dealer that intentionally biases the finesses. The only thing we do is swap the South hand with the one that has the most HCP, in the "Best Hand" tournaments. We don't rearrange the other hands.
When you play at the club, are they computer-dealt or hand-shuffled? Hand shuffling is known to be notoriously poor.
#5
Posted 2014-December-18, 04:09
#6
Posted 2014-December-18, 05:34
funnyman, on 2014-December-12, 12:19, said:
I don't really know how the BBO events work, I'm afraid, but I think you should consider sitting EW for a change rather than NS (or vice versa if you normally sit EW) - if the finesses are always failing for NS then they will be working for EW.....
#7
Posted 2014-December-18, 09:18
WellSpyder, on 2014-December-18, 05:34, said:
In the Main Bridge Club you can choose your seat. But in tournaments, the software chooses your seat for you. In Robot tournaments, the human is always South. In human tournaments, the seats are assigned randomly (although in stratified tourneys it tries to balance the NS and EW fields).
#8
Posted 2014-December-18, 10:22
barmar, on 2014-December-18, 09:18, said:
In that case I can only suggest funnyman changes his username and tries not to upset the computer again, otherwise it seems like he will always be destined to come off worse with finesses.
#9
Posted 2014-December-19, 10:20
WellSpyder, on 2014-December-18, 10:22, said:
A simple tinfoil hat should suffice. Then the computer won't be able to read his brainwaves to tell which way he's going to take 2-way finesses, and move the queen behind it.
#10
Posted 2014-December-19, 12:24
barmar, on 2014-December-12, 15:32, said:
I assure you that nothing is done in the BBO dealer that intentionally biases the finesses. The only thing we do is swap the South hand with the one that has the most HCP, in the "Best Hand" tournaments. We don't rearrange the other hands.
When you play at the club, are they computer-dealt or hand-shuffled? Hand shuffling is known to be notoriously poor.
If dealing is done like I suspect there is minor bias from the process. Starting from ordered pack causes a bias always but there is statical test for the dealer program that proofs it generates random hands when dealing a very large number of boards in a single run. That is easy also reason why it works because random shuffle is applied to randomly ordered pack from previous board so even a poor prng can make statically good shuffles.
#11
Posted 2014-December-19, 13:56
WellSpyder, on 2014-December-18, 10:22, said:
Maybe the computer likes him, and is dealing him example hands where perfect play avoids the finesse as a learning exercise. If he gives up his account, can I have it?
#12
Posted 2014-December-19, 15:21
It's just getting 96 bits of entropy/hand and generating the relevant page out of, for instance, The Impossible Bridge Book.
#13
Posted 2014-December-19, 15:30
mycroft, on 2014-December-19, 15:21, said:
It's just getting 96 bits of entropy/hand and generating the relevant page out of, for instance, The Impossible Bridge Book.
http://en.wikipedia....93Yates_shuffle
That is by far easiest and fastest dealing approach. I have tried implementing the 96bit entropy dealer but it was slower because even table look up ncr calculation is slower than the simple shuffle implementation. Also that shuffle repeated from previous generate hand instead of always from original ordered pack improves statical quality of generated hands.
#14
Posted 2014-December-22, 13:21
So, if there are benefits of the shuffle from random in your statistics, it's either because it's not a perfect shuffle (proven incorrect), or the implementation is biased (which I will assume is incorrect), or your source of randomness isn't perfectly random (which wouldn't surprise me in the slightest; perfect randomness is very difficult to get, and get right - see your Wikipaedia article for several of the problems).
2) note that neither Andrews' or Pavlicek's implmentation is a table lookup - however it does do some pretty heavy bignum maths (div and mod some huge numbers, and lots of combinatorics) which would likely be slower than Fisher-Yates. Are you building a million bridge hands? Were I BBO, I'd have a tiny server (with a hardware RNG) sitting around running hands 24/7, and feeding them to the real BBO as requested.
Bigdeal and other generators use randomness from user events (as does PGP and other keygenerators) - so it takes about 10 seconds to do enough random things to gen out 36 hands. If doing the hands by impossible bridge book takes .1 second rather than .04 seconds - don't care (obviously in BBO's case, with a real hardware RNG, it takes effectively zero time to get randomness, so now the limiting factor is the calculation engine.
Thank you for pointing me at that - every time I've seen someone implement a bridge shuffle before, it's been "intuitively right", but actually wrong. This one at least is sensible, and doesn't use big numbers, given a true source of randomness. Given the modulo issues, however, I expect that *more* randomness is needed to generate each element of that truly random sequence in turn than to generate the bignum and keep div and mod-ing it (especially since we actually don't care about the specific deck ordering, just the combination that generates a bridge hand. You need about 96 bits of randomness for a bridge hand, but 226 for a complete deck ordering). Since computer time is cheap and true randomness is expensive and difficult, I still lean to the "gen a number and pull the relevant bridge hand".
#15
Posted 2014-December-22, 15:49
Any other tales of woe?
#16
Posted 2014-December-22, 16:42
barmar, on 2014-December-19, 10:20, said:
If you hover over a card like you are going to finesse with it, and quickly switch to a top card in the suit and then finesse the other way before the computer can figure out what you are doing , you can improve your finessing odds to almost 33%. If you put an accurate skill level in your profile, you get a bonus 5% extra finesses working.
#17
Posted 2014-December-22, 18:15
mycroft, on 2014-December-22, 13:21, said:
https://github.com/s...r/dealer.c#L651
I think that older version before my changes is used to generate BBO deals. At least all information points toward that. It has fairly good prng called from shuffle code. It uses 16*52 bits of prng stream to generate a board. That code is not aimed to generate high quality deals but good quality deals for statistical analyze of different bridge situations. That code requires around 1000 CPU cycles to generate a board with some tweaking it could probably take about 500 cycles per board.
The shuffle implementation is a bit different to original shuffle algorithm. It should give correct probabilities for each card (as far as I understand probabilities) if we had true random numbers. I agree that true randomness is very hard.
#18
Posted 2014-December-23, 08:33
suokko, on 2014-December-19, 12:24, said:
I don't understand this - are you saying that the dealing program simulates a permutation and applies that permutation to the previous shuffle? Seems odd to me. I would expect it to apply the permuation to an ordered deck, i.o.w. the shuffle depends on the seed and not (explicitly) on the previous deal.
Of course this doesn't matter, it is just a question of what is simpler to implement.
#19
Posted 2014-December-23, 15:50
Every single finesse was on. The only misfeature of the layout was that the opponents had 4-card suits. Even the ♠A was position properly so that I the K would be a safe entry to dummy to repeat the ♦ finesse.
The odds against 6 out of 6 finesses is 64:1.
#20
Posted 2014-December-23, 16:10
barmar, on 2014-December-23, 15:50, said:
Every single finesse was on. The only misfeature of the layout was that the opponents had 4-card suits. Even the ♠A was position properly so that I the K would be a safe entry to dummy to repeat the ♦ finesse.
The odds against 6 out of 6 finesses is 64:1.
And yet, on a low club lead or A and another the contract is down one on any line of play.