Converted document

OpenHoldem

Rankbits explained

OpenHoldem uses the following method to classify a group of cards according to rank within a single value. Note that if an ace is present then both the 14 bit and the 1 bit will be set.
figure symbols/Images/Rankbits.png
Figure None.1 Rank bits
Bit Meaning Decimal value
15 not used 32768
14 Ace (high) 16384
13 King 8192
12 Queen 4096
11 Jack 2048
10 Ten 1024
9 9 512
8 8 256
7 7 126
6 6 64
5 5 32
4 4 16
3 3 8
2 2 4
1 Ace (low) 2
0 not used 1
figure symbols/Images/rankbits_manualmode.png
In this example rankbits is 20518 (decimal), which is 0b101000000100110 (binary)
101000000100110
A-Q------5--2A-
A quick calculation will verify that 20518 is the sum of the card-values in the table above:
Ace (high) 16384
Queen 4096
Five 32
Two 4
Ace (low) 2
rankbits (sum) 20518
Now a quick check, if an ace is on the board:
##f$ace_on_the_board##
(rankbitscommon & 0x4000) != 0
This code will just execute a bit-wise AND-operation of the ACE-high-bit and then check if the result is non-zero, i.e ace present. 0x4000 is the hexadecimal representation of 0b0010000000000000, that’s just more easy to write and read than plain binary, and very easy to transform.
If you have never worked with binary numbers before — don’t get confused. Just try out MicroSofts calculator and select scientif view. Things will become easy.
Document generated by eLyXer 1.2.5 (2013-03-10) on 2014-12-30T22:33:30.921000