You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$communityCards = [new Card('3h'), new Card('Jd'), new Card('Qd'), new Card('Ad'), new Card('Kd')];
30
30
$communityCards = [new Card('3h'), 'Jd', new Card('Qd'), 'Ad', new Card('Kd')]; // A mix of both
31
31
```
32
+
33
+
Once a hand has been instantiated, you are able to get the hand description as well as a numerical value of the hand used for comparing against other hands.
34
+
35
+
```php
36
+
use simplehacker\PHPoker\Hands\TexasHoldemHand;
37
+
38
+
$communityCards = '3hJdQdAdKd';
39
+
$holeCards = 'Td6s';
40
+
41
+
$hand = new TexasHoldemHand($communityCards, $holeCards);
42
+
43
+
// Royal Flush, Ace to Ten of Diamonds
44
+
$hand->getDescription();
45
+
46
+
// AdKdQdJdTd
47
+
$hand->getShortDescription();
48
+
49
+
// 10
50
+
$hand->getHandRank();
51
+
52
+
// const ROYAL_FLUSH_RANK = 10;
53
+
// const STRAIGHT_FLUSH_RANK = 9;
54
+
// const FOUR_OF_A_KIND_RANK = 8;
55
+
// const FULL_HOUSE_RANK = 7;
56
+
// const FLUSH_RANK = 6;
57
+
// const STRAIGHT_RANK = 5;
58
+
// const THREE_OF_A_KIND_RANK = 4;
59
+
// const TWO_PAIR_RANK = 3;
60
+
// const ONE_PAIR_RANK = 2;
61
+
// const HIGH_CARD_RANK = 1;
62
+
63
+
// 11459770
64
+
$hand->getHandValue();
65
+
66
+
// Hand value is generated from converting Hand Rank and all Card values to a binary string, and converting back to base 10. This ensures the best hand will always be the highest number
67
+
```
68
+
69
+
32
70
## Cards
71
+
Cards can be instantiated in numerous ways. The follwing all result in the Ace of Spades:
72
+
73
+
```php
74
+
// As a short value where the first character is 23456789TJQKA and the suit as shcd
75
+
new Card('As');
33
76
77
+
// Arguments for both value and suit
78
+
new Card('Ace', 'Spades');
79
+
new Card('A', 's');
34
80
81
+
// As numerical values
82
+
// Jack = 11, Queen = 12, King = 13, Ace = 1 or 14
0 commit comments