BBO random generator
#1
Posted 2012-October-05, 07:44
Is there any resource about BBO random generator ? I am just curios, I am aware that probably my intuition is just wrong about it but I would like to see what kind of generator BBO is using and if it is good.
#2
Posted 2012-October-07, 01:38
bluecalm, on 2012-October-05, 07:44, said:
Is there any resource about BBO random generator ? I am just curios, I am aware that probably my intuition is just wrong about it but I would like to see what kind of generator BBO is using and if it is good.
This probably a better question for the BBO Support Forum- there you might get an answer.
#3
Posted 2012-October-07, 02:16
#4
Posted 2012-October-09, 13:59
Antrax, on 2012-October-07, 02:16, said:
My understanding was that hand-dealing actually results in flatter hands. Regardless he was comparing BBO dealt hands to other computer dealt hands and in both cases while computer pseudo random number generation is not truly random(hence the pseudo) the difference is utterly indistinguishable to humans*. Pseudo random number generation has been a solved problem for over a decade and it is very unlikely either bbo or another computer dealing program is screwing it up. Possible, but here I would wager pretty heavily on your intuition being wrong.
*without taking a lot of actual unbiased samples and pouring over them with some math.
#5
Posted 2012-October-09, 22:10
Intuitively, hand-dealing depends on the algorithm used, but from my experience, people usually just do a couple of riffle shuffles. Those tend to leave clumps intact, especially as the cards age. That would result in hands with wilder shape and an uneven distribution of HCP, as people tend to do things like clear suits and cash out, which cause HCPs and suits to bunch together at the end of play.
But there's an awful lot of speculation here from my part, so if anyone has contrary notions, feel free to correct me.
#6
Posted 2012-October-10, 09:12
for ( w=1; w<4; w++ ) { for ( c=0; c<13; c++ ) { do { s=rand()%4; c1=rand()%13; } while ( PLAYARRAY[s][c1]!=0 ); PLAYARRAY[s][c1]=w; } }
The Linux rand() function isn't random enough for cryptographic use, but it seems to be good enough for dealing bridge hands. Uday told me that we get the expected statistics of hand distributions.
#7
Posted 2012-October-10, 09:22
#8
Posted 2012-October-10, 09:27
#9
Posted 2012-October-10, 10:52
But beyond that, if there is any tilt to rand()% implementation, the order and method of dealing cards is greatly magnifying it.
Player 1 is getting the first 13 cards dealt and as such any tilt means that he is vastly more likely to get the more common rand results. Player 4 is in the exact opposite position.
If you merely reversed the order of the w and c for loops, you would nullify the vast majority of this bias. This would effectively be equivalent to dealing around the table rather then taking 13 cards off the top and giving them to player 1.
Of course, if rand()% is effectively random and unbiased, then everything is fine. But a lot of literature says that this can be very problematic.
#10
Posted 2012-October-10, 12:41
I think that's negligible. So while there may be better ways to deal, I don't think we gain much by "fixing" it.
#11
Posted 2012-October-10, 12:53
#12
Posted 2012-October-10, 16:32
I wonder how much dealing the first 13 cards to player 1 increases the 0.0000003% for that player.
#13
Posted 2012-October-10, 17:50
dwar0123, on 2012-October-10, 16:32, said:
I wonder how much dealing the first 13 cards to player 1 increases the 0.0000003% for that player.
If the dealer were perfectly random, each card dealt to a player would have a 9/13 chance of being 2-10. Because of this minor flaw, that chance is increased to 9.000000027/13 for the first card dealt to player 1. As each card is dealt, the probabilities change a bit because of the cards that are no longer available to be dealt, but I believe the difference from perfection will be of a similar magnitude.
So player N is slightly more likely to have low cards than player N+1. But this extra likelihood is on the order of 1 in 10 million. While this is better than playing the lottery, it still doesn't seem like something you can take advantage of. If you play 1,000 hands a day, and play these odds, you'll get a benefit once every 10,000 days, which is 27 years. Most of the probability factors that we deal with in bridge are on the order of a percent or more, and this additional factor is totally negligible compared to them. If you had a true 2-way guess for an honor, you might as well finesse away from a lower-numbered hand; but I'll bet if you really thought about it you could find some information that helps you more than this tiny fraction -- it's negligible compared to a single vacant space.
BTW, if you play best-hand robot tourneys, hand 1 is the human's hand, and his hand is swapped with the best hand after the dealing. So there's no way of knowing where hand 1 ended up (but I suppose hand 4 is infinitessimally more likely to be the best hand, so a 1<->4 swap is ever so slightly more likely).
#14
Posted 2012-October-10, 22:03
nigel_k, on 2012-October-10, 12:53, said:
To answer to that you need to estimate how big BBO is now? I bet GIB running simulations during bidding is the heaviest part since its supposed to simulate the complete bidding sequence and play sequence.
#15
Posted 2012-October-11, 09:06
#16
Posted 2012-October-11, 13:49
-gwnn
#17
Posted 2012-October-11, 14:27
billw55, on 2012-October-11, 13:49, said:
That wouldn't actually solve the (non)problem. The problem is that max number that rand() can come up with isn't divisible by 13, thus when you use the % operator(mod), there are more cases for the lower numbers than the higher numbers.
As an example, we can use a really tiny max number to make it really explicit.
If the max number rand() can come up with is 2^4-1(15). Thus rand() will generate an integer between 0 and 15 inclusive.
0 % 13 = 0
1 % 13 = 1
2 % 13 = 2
3 % 13 = 3
4 % 13 = 4
...
13 % 13 = 0
14 % 13 = 1
15 % 13 = 2
If we assign 0 to represent dealing a 2 of a suit and 12 to an Ace of a suit than the first card dealt is twice as likely to be a 2(0) than an A(12). What seed we use has no impact on this.
However using a really gigantic MAX_RAND diminishes the biases to the level Barmar stated.
#18
Posted 2012-October-11, 17:56
Unix/Linux has /dev/urandom, which is non-pseudo RNG, it generates bits out of an entropy pool it tries to keep up by using environmental randomness. For BBO, I wouldn't worry about rand(); for people making hand records for Bermuda Bowl and the like, avoiding a PRNG is probably worth it - I postulated years ago that someone with $1M to build special hardware and access to the vugraph could likely crack a 36-deal set made from a single seed in time to know the last few boards. Computing power hasn't got *more expensive*.
Take log2(hands^36) bits of true randomness (or log2(hands)*36, if randomness is cheaper than huge modulo division (which it probably is)) and build 36 unconnected, true random hands for each set, and you've OTPed it. But, as I said, that's almost certainly overkill for BBO.
#20
Posted 2012-October-11, 18:35
mycroft, on 2012-October-11, 17:56, said:
So if JEC or Nickell wanted to cheat, they could afford to build that machine. I'm not too worried about it. It's still out of reach of some random player trying to win the BB.