From 1b25a8d04cd9a880731d41d45b0f2a13ea1685ed Mon Sep 17 00:00:00 2001 From: resu-xuniL Date: Thu, 2 Jul 2026 20:18:46 +0200 Subject: [PATCH 1/5] sync poker --- bin/auto-sync.txt | 1 + .../practice/poker/.docs/instructions.md | 4 +- exercises/practice/poker/.meta/config.json | 7 +- exercises/practice/poker/.meta/example.php | 22 -- exercises/practice/poker/.meta/tests.toml | 131 ++++++++ exercises/practice/poker/PokerTest.php | 301 +++++++++++++++--- 6 files changed, 389 insertions(+), 77 deletions(-) create mode 100644 exercises/practice/poker/.meta/tests.toml diff --git a/bin/auto-sync.txt b/bin/auto-sync.txt index 9864b32a4..65f933584 100644 --- a/bin/auto-sync.txt +++ b/bin/auto-sync.txt @@ -62,6 +62,7 @@ pascals-triangle perfect-numbers phone-number pig-latin +poker protein-translation proverb queen-attack diff --git a/exercises/practice/poker/.docs/instructions.md b/exercises/practice/poker/.docs/instructions.md index 23e98a21c..107cd49d6 100644 --- a/exercises/practice/poker/.docs/instructions.md +++ b/exercises/practice/poker/.docs/instructions.md @@ -2,4 +2,6 @@ Pick the best hand(s) from a list of poker hands. -See [wikipedia](https://en.wikipedia.org/wiki/List_of_poker_hands) for an overview of poker hands. +See [Wikipedia][poker-hands] for an overview of poker hands. + +[poker-hands]: https://en.wikipedia.org/wiki/List_of_poker_hands diff --git a/exercises/practice/poker/.meta/config.json b/exercises/practice/poker/.meta/config.json index 9db54f7f0..503d61272 100644 --- a/exercises/practice/poker/.meta/config.json +++ b/exercises/practice/poker/.meta/config.json @@ -2,6 +2,9 @@ "authors": [ "MichaelBunker" ], + "contributors": [ + "resu-xuniL" + ], "files": { "solution": [ "Poker.php" @@ -13,5 +16,7 @@ ".meta/example.php" ] }, - "blurb": "Pick the best hand(s) from a list of poker hands." + "blurb": "Pick the best hand(s) from a list of poker hands.", + "source": "Inspired by the training course from Udacity.", + "source_url": "https://www.udacity.com/course/design-of-computer-programs--cs212" } diff --git a/exercises/practice/poker/.meta/example.php b/exercises/practice/poker/.meta/example.php index 950887e66..695c53bae 100644 --- a/exercises/practice/poker/.meta/example.php +++ b/exercises/practice/poker/.meta/example.php @@ -1,27 +1,5 @@ . - * - * To disable strict typing, comment out the directive below. - */ - declare(strict_types=1); class Poker diff --git a/exercises/practice/poker/.meta/tests.toml b/exercises/practice/poker/.meta/tests.toml new file mode 100644 index 000000000..2e654ef63 --- /dev/null +++ b/exercises/practice/poker/.meta/tests.toml @@ -0,0 +1,131 @@ +# This is an auto-generated file. +# +# Regenerating this file via `configlet sync` will: +# - Recreate every `description` key/value pair +# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications +# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion) +# - Preserve any other key/value pair +# +# As user-added comments (using the # character) will be removed when this file +# is regenerated, comments can be added via a `comment` key. + +[161f485e-39c2-4012-84cf-bec0c755b66c] +description = "single hand always wins" + +[370ac23a-a00f-48a9-9965-6f3fb595cf45] +description = "highest card out of all hands wins" + +[d94ad5a7-17df-484b-9932-c64fc26cff52] +description = "a tie has multiple winners" + +[61ed83a9-cfaa-40a5-942a-51f52f0a8725] +description = "multiple hands with the same high cards, tie compares next highest ranked, down to last card" + +[da01becd-f5b0-4342-b7f3-1318191d0580] +description = "winning high card hand also has the lowest card" + +[f7175a89-34ff-44de-b3d7-f6fd97d1fca4] +description = "one pair beats high card" + +[e114fd41-a301-4111-a9e7-5a7f72a76561] +description = "highest pair wins" + +[b3acd3a7-f9fa-4647-85ab-e0a9e07d1365] +description = "both hands have the same pair, high card wins" + +[935bb4dc-a622-4400-97fa-86e7d06b1f76] +description = "two pairs beats one pair" + +[c8aeafe1-6e3d-4711-a6de-5161deca91fd] +description = "both hands have two pairs, highest ranked pair wins" + +[88abe1ba-7ad7-40f3-847e-0a26f8e46a60] +description = "both hands have two pairs, with the same highest ranked pair, tie goes to low pair" + +[15a7a315-0577-47a3-9981-d6cf8e6f387b] +description = "both hands have two identically ranked pairs, tie goes to remaining card (kicker)" + +[f761e21b-2560-4774-a02a-b3e9366a51ce] +description = "both hands have two pairs that add to the same value, win goes to highest pair" + +[fc6277ac-94ac-4078-8d39-9d441bc7a79e] +description = "two pairs first ranked by largest pair" + +[21e9f1e6-2d72-49a1-a930-228e5e0195dc] +description = "three of a kind beats two pair" + +[c2fffd1f-c287-480f-bf2d-9628e63bbcc3] +description = "both hands have three of a kind, tie goes to highest ranked triplet" + +[eb856cc2-481c-4b0d-9835-4d75d07a5d9d] +description = "with multiple decks, two players can have same three of a kind, ties go to highest remaining cards" +include = false + +[26a4a7d4-34a2-4f18-90b4-4a8dd35d2bb1] +description = "with multiple decks, two players can have same three of a kind, ties go to highest remaining cards" +reimplements = "eb856cc2-481c-4b0d-9835-4d75d07a5d9d" + +[a858c5d9-2f28-48e7-9980-b7fa04060a60] +description = "a straight beats three of a kind" + +[73c9c756-e63e-4b01-a88d-0d4491a7a0e3] +description = "aces can end a straight (10 J Q K A)" + +[76856b0d-35cd-49ce-a492-fe5db53abc02] +description = "aces can start a straight (A 2 3 4 5)" + +[e214b7df-dcba-45d3-a2e5-342d8c46c286] +description = "aces cannot be in the middle of a straight (Q K A 2 3)" + +[6980c612-bbff-4914-b17a-b044e4e69ea1] +description = "both hands with a straight, tie goes to highest ranked card" + +[5135675c-c2fc-4e21-9ba3-af77a32e9ba4] +description = "even though an ace is usually high, a 5-high straight is the lowest-scoring straight" + +[c601b5e6-e1df-4ade-b444-b60ce13b2571] +description = "flush beats a straight" + +[4d90261d-251c-49bd-a468-896bf10133de] +description = "both hands have a flush, tie goes to high card, down to the last one if necessary" +include = false + +[e04137c5-c19a-4dfc-97a1-9dfe9baaa2ff] +description = "both hands have a flush, tie goes to high card, down to the last one if necessary" +reimplements = "4d90261d-251c-49bd-a468-896bf10133de" + +[3a19361d-8974-455c-82e5-f7152f5dba7c] +description = "full house beats a flush" + +[eb73d0e6-b66c-4f0f-b8ba-bf96bc0a67f0] +description = "both hands have a full house, tie goes to highest-ranked triplet" + +[34b51168-1e43-4c0d-9b32-e356159b4d5d] +description = "with multiple decks, both hands have a full house with the same triplet, tie goes to the pair" + +[d61e9e99-883b-4f99-b021-18f0ae50c5f4] +description = "four of a kind beats a full house" + +[2e1c8c63-e0cb-4214-a01b-91954490d2fe] +description = "both hands have four of a kind, tie goes to high quad" + +[892ca75d-5474-495d-9f64-a6ce2dcdb7e1] +description = "with multiple decks, both hands with identical four of a kind, tie determined by kicker" + +[923bd910-dc7b-4f7d-a330-8b42ec10a3ac] +description = "straight flush beats four of a kind" + +[d9629e22-c943-460b-a951-2134d1b43346] +description = "aces can end a straight flush (10 J Q K A)" + +[05d5ede9-64a5-4678-b8ae-cf4c595dc824] +description = "aces can start a straight flush (A 2 3 4 5)" + +[ad655466-6d04-49e8-a50c-0043c3ac18ff] +description = "aces cannot be in the middle of a straight flush (Q K A 2 3)" + +[d0927f70-5aec-43db-aed8-1cbd1b6ee9ad] +description = "both hands have a straight flush, tie goes to highest-ranked card" + +[be620e09-0397-497b-ac37-d1d7a4464cfc] +description = "even though an ace is usually high, a 5-high straight flush is the lowest-scoring straight flush" diff --git a/exercises/practice/poker/PokerTest.php b/exercises/practice/poker/PokerTest.php index ee17d480f..a74f5bcf6 100644 --- a/exercises/practice/poker/PokerTest.php +++ b/exercises/practice/poker/PokerTest.php @@ -1,30 +1,9 @@ . - * - * To disable strict typing, comment out the directive below. - */ - declare(strict_types=1); use PHPUnit\Framework\TestCase; +use PHPUnit\Framework\Attributes\TestDox; class PokerTest extends TestCase { @@ -33,6 +12,10 @@ public static function setUpBeforeClass(): void require_once 'Poker.php'; } + /** + * uuid: 161f485e-39c2-4012-84cf-bec0c755b66c + */ + #[TestDox('single hand always wins')] public function testSingleHandAlwaysWins(): void { $hands = ['4S,5S,7H,8D,JC']; @@ -41,6 +24,10 @@ public function testSingleHandAlwaysWins(): void $this->assertEquals(['4S,5S,7H,8D,JC'], $game->bestHands); } + /** + * uuid: 370ac23a-a00f-48a9-9965-6f3fb595cf45 + */ + #[TestDox('highest card out of all hands wins')] public function testHighestCardOutOfAllHandsWins(): void { $hands = ['4D,5S,6S,8D,3C', '2S,4C,7S,9H,10H', '3S,4S,5D,6H,JH']; @@ -49,7 +36,11 @@ public function testHighestCardOutOfAllHandsWins(): void $this->assertEquals(['3S,4S,5D,6H,JH'], $game->bestHands); } - public function testHighCardTiesHaveMultipleWinners(): void + /** + * uuid: d94ad5a7-17df-484b-9932-c64fc26cff52 + */ + #[TestDox('a tie has multiple winners')] + public function testATieHasMultipleWinners(): void { $hands = ['4D,5S,6S,8D,3C', '2S,4C,7S,9H,10H', '3S,4S,5D,6H,JH', '3H,4H,5C,6C,JD']; $game = new Poker($hands); @@ -57,7 +48,11 @@ public function testHighCardTiesHaveMultipleWinners(): void $this->assertEquals(['3S,4S,5D,6H,JH', '3H,4H,5C,6C,JD'], $game->bestHands); } - public function testMultipleHandsWithSameHighCardsNextHighestCardWins(): void + /** + * uuid: 61ed83a9-cfaa-40a5-942a-51f52f0a8725 + */ + #[TestDox('multiple hands with the same high cards, tie compares next highest ranked, down to last card')] + public function testMultipleHandsWithTheSameHighCardsTieComparesNextHighestRankedDownToLastCard(): void { $hands = ['3S,5H,6S,8D,7H', '2S,5D,6D,8C,7S']; $game = new Poker($hands); @@ -65,6 +60,22 @@ public function testMultipleHandsWithSameHighCardsNextHighestCardWins(): void $this->assertEquals(['3S,5H,6S,8D,7H'], $game->bestHands); } + /** + * uuid: da01becd-f5b0-4342-b7f3-1318191d0580 + */ + #[TestDox('winning high card hand also has the lowest card')] + public function testWinningHighCardHandAlsoHasTheLowestCard(): void + { + $hands = ['2S,5H,6S,8D,7H', '3S,4D,6D,8C,7S']; + $game = new Poker($hands); + + $this->assertEquals(['2S,5H,6S,8D,7H'], $game->bestHands); + } + + /** + * uuid: f7175a89-34ff-44de-b3d7-f6fd97d1fca4 + */ + #[TestDox('one pair beats high card')] public function testOnePairBeatsHighCard(): void { $hands = ['4S,5H,6C,8D,KH', '2S,4H,6S,4D,JH']; @@ -73,6 +84,10 @@ public function testOnePairBeatsHighCard(): void $this->assertEquals(['2S,4H,6S,4D,JH'], $game->bestHands); } + /** + * uuid: e114fd41-a301-4111-a9e7-5a7f72a76561 + */ + #[TestDox('highest pair wins')] public function testHighestPairWins(): void { $hands = ['4S,2H,6S,2D,JH', '2S,4H,6C,4D,JD']; @@ -81,23 +96,23 @@ public function testHighestPairWins(): void $this->assertEquals(['2S,4H,6C,4D,JD'], $game->bestHands); } - public function testTwoPairsThatAddToTheSameValue() + /** + * uuid: b3acd3a7-f9fa-4647-85ab-e0a9e07d1365 + */ + #[TestDox('both hands have the same pair, high card wins')] + public function testBothHandsHaveTheSamePairHighCardWins(): void { - $hands = ['6S,6H,3S,3H,AS', '7H,7S,2H,2S,AC']; + $hands = ['4H,4S,AH,JC,3D', '4C,4D,AS,5D,6C']; $game = new Poker($hands); - $this->assertEquals(['7H,7S,2H,2S,AC'], $game->bestHands); - } - - public function testTwoPairsWhereLowerHandHasHigherTotal() - { - $hands = ["5C,2S,5S,4H,4C", "6S,2S,6H,7C,2C"]; - $game = new Poker($hands); - - $this->assertEquals(["6S,2S,6H,7C,2C"], $game->bestHands); + $this->assertEquals(['4H,4S,AH,JC,3D'], $game->bestHands); } - public function testTwoPairBeatsOnePair(): void + /** + * uuid: 935bb4dc-a622-4400-97fa-86e7d06b1f76 + */ + #[TestDox('two pairs beats one pair')] + public function testTwoPairsBeatsOnePair(): void { $hands = ['2S,8H,6S,8D,JH', '4S,5H,4C,8C,5C']; $game = new Poker($hands); @@ -105,7 +120,11 @@ public function testTwoPairBeatsOnePair(): void $this->assertEquals(['4S,5H,4C,8C,5C'], $game->bestHands); } - public function testHighestTwoPairWins(): void + /** + * uuid: c8aeafe1-6e3d-4711-a6de-5161deca91fd + */ + #[TestDox('both hands have two pairs, highest ranked pair wins')] + public function testBothHandsHaveTwoPairsHighestRankedPairWins(): void { $hands = ['2S,8H,2D,8D,3H', '4S,5H,4C,8S,5D']; $game = new Poker($hands); @@ -113,7 +132,11 @@ public function testHighestTwoPairWins(): void $this->assertEquals(['2S,8H,2D,8D,3H'], $game->bestHands); } - public function testSameHighPairForTwoPairHigherSecondPairWins(): void + /** + * uuid: 88abe1ba-7ad7-40f3-847e-0a26f8e46a60 + */ + #[TestDox('both hands have two pairs, with the same highest ranked pair, tie goes to low pair')] + public function testBothHandsHaveTwoPairsWithTheSameHighestRankedPairTieGoesToLowPair(): void { $hands = ['2S,QS,2C,QD,JH', 'JD,QH,JS,8D,QC']; $game = new Poker($hands); @@ -121,7 +144,11 @@ public function testSameHighPairForTwoPairHigherSecondPairWins(): void $this->assertEquals(['JD,QH,JS,8D,QC'], $game->bestHands); } - public function testSameTwoPairsForTwoPairHighCardWins(): void + /** + * uuid: 15a7a315-0577-47a3-9981-d6cf8e6f387b + */ + #[TestDox('both hands have two identically ranked pairs, tie goes to remaining card (kicker)')] + public function testBothHandsHaveTwoIdenticallyRankedPairsTieGoesToRemainingCard(): void { $hands = ['JD,QH,JS,8D,QC', 'JS,QS,JC,2D,QD']; $game = new Poker($hands); @@ -129,6 +156,34 @@ public function testSameTwoPairsForTwoPairHighCardWins(): void $this->assertEquals(['JD,QH,JS,8D,QC'], $game->bestHands); } + /** + * uuid: f761e21b-2560-4774-a02a-b3e9366a51ce + */ + #[TestDox('both hands have two pairs that add to the same value, win goes to highest pair')] + public function testBotHandsHaveTwoPairsThatAddToTheSameValueWinGoesToHighestPair() + { + $hands = ['6S,6H,3S,3H,AS', '7H,7S,2H,2S,AC']; + $game = new Poker($hands); + + $this->assertEquals(['7H,7S,2H,2S,AC'], $game->bestHands); + } + + /** + * uuid: fc6277ac-94ac-4078-8d39-9d441bc7a79e + */ + #[TestDox('two pairs first ranked by largest pair')] + public function testTwoPairsFirstRankedByLargestPair() + { + $hands = ["5C,2S,5S,4H,4C", "6S,2S,6H,7C,2C"]; + $game = new Poker($hands); + + $this->assertEquals(["6S,2S,6H,7C,2C"], $game->bestHands); + } + + /** + * uuid: 21e9f1e6-2d72-49a1-a930-228e5e0195dc + */ + #[TestDox('three of a kind beats two pair')] public function testThreeOfAKindBeatsTwoPair(): void { $hands = ['2S,8H,2H,8D,JH', '4S,5H,4C,8S,4H']; @@ -137,7 +192,11 @@ public function testThreeOfAKindBeatsTwoPair(): void $this->assertEquals(['4S,5H,4C,8S,4H'], $game->bestHands); } - public function testHighestThreeOfAKindWins(): void + /** + * uuid: c2fffd1f-c287-480f-bf2d-9628e63bbcc3 + */ + #[TestDox('both hands have three of a kind, tie goes to highest ranked triplet')] + public function testBothHandsHaveThreeOfAKindTieGoesToHighestRankedTriplet(): void { $hands = ['2S,2H,2C,8D,JH', '4S,AH,AS,8C,AD']; $game = new Poker($hands); @@ -145,14 +204,24 @@ public function testHighestThreeOfAKindWins(): void $this->assertEquals(['4S,AH,AS,8C,AD'], $game->bestHands); } - public function testSameThreeOfAKindHighCardsWin(): void + /** + * Ensure that high cards are checked in the correct order (high to low). + * + * uuid: 26a4a7d4-34a2-4f18-90b4-4a8dd35d2bb1 + */ + #[TestDox('with multiple decks, two players can have same three of a kind, ties go to highest remaining cards')] + public function testWithMultipleDecksTwoPlayersCanHaveSameThreeOfAKindTiesGoToHighestRemainingCards(): void { - $hands = ['4S,AH,AS,7C,AD', '4S,AH,AS,8C,AD']; + $hands = ['5S,AH,AS,7C,AD', '4S,AH,AS,8C,AD']; $game = new Poker($hands); $this->assertEquals(['4S,AH,AS,8C,AD'], $game->bestHands); } + /** + * uuid: a858c5d9-2f28-48e7-9980-b7fa04060a60 + */ + #[TestDox('a straight beats three of a kind')] public function testStraightBeatsThreeOfAKind(): void { $hands = ['4S,5H,4C,8D,4H', '3S,4D,2S,6D,5C']; @@ -161,7 +230,11 @@ public function testStraightBeatsThreeOfAKind(): void $this->assertEquals(['3S,4D,2S,6D,5C'], $game->bestHands); } - public function testAcesCanBeHighCardForAStraight(): void + /** + * uuid: 73c9c756-e63e-4b01-a88d-0d4491a7a0e3 + */ + #[TestDox('aces can end a straight (10 J Q K A)')] + public function testAcesCanEndAStraight(): void { $hands = ['4S,5H,4C,8D,4H', '10D,JH,QS,KD,AC']; $game = new Poker($hands); @@ -169,7 +242,11 @@ public function testAcesCanBeHighCardForAStraight(): void $this->assertEquals(['10D,JH,QS,KD,AC'], $game->bestHands); } - public function testAcesCanBeLowCardForAStraight(): void + /** + * uuid: 76856b0d-35cd-49ce-a492-fe5db53abc02 + */ + #[TestDox('aces can start a straight (A 2 3 4 5)')] + public function testAcesCanStartAStraight(): void { $hands = ['4S,5H,4C,8D,4H', '4D,AH,3S,2D,5C']; $game = new Poker($hands); @@ -177,7 +254,23 @@ public function testAcesCanBeLowCardForAStraight(): void $this->assertEquals(['4D,AH,3S,2D,5C'], $game->bestHands); } - public function testHigherStraightWins(): void + /** + * uuid: e214b7df-dcba-45d3-a2e5-342d8c46c286 + */ + #[TestDox('aces cannot be in the middle of a straight (Q K A 2 3)')] + public function testAcesCannotBeInTheMiddleOfAStraight(): void + { + $hands = ['2C,3D,7H,5H,2S', 'QS,KH,AC,2D,3S']; + $game = new Poker($hands); + + $this->assertEquals(['2C,3D,7H,5H,2S'], $game->bestHands); + } + + /** + * uuid: 6980c612-bbff-4914-b17a-b044e4e69ea1 + */ + #[TestDox('both hands with a straight, tie goes to highest ranked card')] + public function testBothHandsWithAStraightTieGoesToHighestRankedCard(): void { $hands = ['4S,6C,7S,8D,5H', '5S,7H,8S,9D,6H']; $game = new Poker($hands); @@ -185,6 +278,22 @@ public function testHigherStraightWins(): void $this->assertEquals(['5S,7H,8S,9D,6H'], $game->bestHands); } + /** + * uuid: 5135675c-c2fc-4e21-9ba3-af77a32e9ba4 + */ + #[TestDox('even though an ace is usually high, a 5-high straight is the lowest-scoring straight')] + public function testEvenThoughAnAceIsUsuallyHighAFiveHighStraightIsTheLowestScoringStraight(): void + { + $hands = ['2H,3C,4D,5D,6H', '4S,AH,3S,2D,5H']; + $game = new Poker($hands); + + $this->assertEquals(['2H,3C,4D,5D,6H'], $game->bestHands); + } + + /** + * uuid: c601b5e6-e1df-4ade-b444-b60ce13b2571 + */ + #[TestDox('flush beats a straight')] public function testFlushBeatsAStraight(): void { $hands = ['4C,6H,7D,8D,5H', '2S,4S,5S,6S,7S']; @@ -193,14 +302,24 @@ public function testFlushBeatsAStraight(): void $this->assertEquals(['2S,4S,5S,6S,7S'], $game->bestHands); } - public function testHighestFlushWins(): void + /** + * Ensure that high cards are checked in the correct order (high to low). + * + * uuid: e04137c5-c19a-4dfc-97a1-9dfe9baaa2ff + */ + #[TestDox('both hands have a flush, tie goes to high card, down to the last one if necessary')] + public function testBothHandsHaveAFlushTieGoesToHighCardDownToTheLastOneIfNecessary(): void { - $hands = ['4H,7H,8H,9H,6H', '2S,4S,5S,6S,7S']; + $hands = ['2H,7H,8H,9H,6H', '3S,5S,6S,7S,8S']; $game = new Poker($hands); - $this->assertEquals(['4H,7H,8H,9H,6H'], $game->bestHands); + $this->assertEquals(['2H,7H,8H,9H,6H'], $game->bestHands); } + /** + * uuid: 3a19361d-8974-455c-82e5-f7152f5dba7c + */ + #[TestDox('full house beats a flush')] public function testFullHouseBeatsAFlush(): void { $hands = ['3H,6H,7H,8H,5H', '4S,5H,4C,5D,4H']; @@ -209,7 +328,11 @@ public function testFullHouseBeatsAFlush(): void $this->assertEquals(['4S,5H,4C,5D,4H'], $game->bestHands); } - public function testHigherTripletFullHouseWins(): void + /** + * uuid: eb73d0e6-b66c-4f0f-b8ba-bf96bc0a67f0 + */ + #[TestDox('both hands have a full house, tie goes to highest-ranked triplet')] + public function testBothHandsHaveAFullHouseTieGoesToHighestRankedTriplet(): void { $hands = ['4H,4S,4D,9S,9D', '5H,5S,5D,8S,8D']; $game = new Poker($hands); @@ -217,7 +340,11 @@ public function testHigherTripletFullHouseWins(): void $this->assertEquals(['5H,5S,5D,8S,8D'], $game->bestHands); } - public function testSameTripleFullHouseHighPairWins(): void + /** + * uuid: e34b51168-1e43-4c0d-9b32-e356159b4d5d + */ + #[TestDox('with multiple decks, both hands have a full house with the same triplet, tie goes to the pair')] + public function testWithMultipleDecksBothHandsHaveAFullHouseWithTheSameTripletTieGoesToThePair(): void { $hands = ['5H,5S,5D,9S,9D', '5H,5S,5D,8S,8D']; $game = new Poker($hands); @@ -225,6 +352,10 @@ public function testSameTripleFullHouseHighPairWins(): void $this->assertEquals(['5H,5S,5D,9S,9D'], $game->bestHands); } + /** + * uuid: d61e9e99-883b-4f99-b021-18f0ae50c5f4 + */ + #[TestDox('four of a kind beats a full house')] public function testFourOfAKindBeatsAFullHouse(): void { $hands = ['4S,5H,4D,5D,4H', '3S,3H,2S,3D,3C']; @@ -233,7 +364,11 @@ public function testFourOfAKindBeatsAFullHouse(): void $this->assertEquals(['3S,3H,2S,3D,3C'], $game->bestHands); } - public function testHigherFourOfAKindWins(): void + /** + * uuid: 2e1c8c63-e0cb-4214-a01b-91954490d2fe + */ + #[TestDox('both hands have four of a kind, tie goes to high quad')] + public function testBothHandsHaveFourOfAKindTieGoesToHighQuad(): void { $hands = ['2S,2H,2C,8D,2D', '4S,5H,5S,5D,5C']; $game = new Poker($hands); @@ -241,7 +376,11 @@ public function testHigherFourOfAKindWins(): void $this->assertEquals(['4S,5H,5S,5D,5C'], $game->bestHands); } - public function testSameFourOfAKindHighCardWins(): void + /** + * uuid: 892ca75d-5474-495d-9f64-a6ce2dcdb7e1 + */ + #[TestDox('with multiple decks, both hands with identical four of a kind, tie determined by kicker')] + public function testWithMultipleDecksBothHandsWithIdenticalFourOfAKindTieDeterminedByKicker(): void { $hands = ['3S,3H,2S,3D,3C', '3S,3H,4S,3D,3C']; $game = new Poker($hands); @@ -249,6 +388,10 @@ public function testSameFourOfAKindHighCardWins(): void $this->assertEquals(['3S,3H,4S,3D,3C'], $game->bestHands); } + /** + * uuid: 923bd910-dc7b-4f7d-a330-8b42ec10a3ac + */ + #[TestDox('straight flush beats four of a kind')] public function testStraightFlushBeatsFourOfAKind(): void { $hands = ['4S,5H,5S,5D,5C', '7S,8S,9S,6S,10S']; @@ -257,11 +400,63 @@ public function testStraightFlushBeatsFourOfAKind(): void $this->assertEquals(['7S,8S,9S,6S,10S'], $game->bestHands); } - public function testHigherStraightFlushWins(): void + /** + * uuid: d9629e22-c943-460b-a951-2134d1b43346 + */ + #[TestDox('aces can end a straight flush (10 J Q K A)')] + public function testAcesCanEndAStraightFlush(): void + { + $hands = ['KC,AH,AS,AD,AC', '10C,JC,QC,KC,AC']; + $game = new Poker($hands); + + $this->assertEquals(['10C,JC,QC,KC,AC'], $game->bestHands); + } + + /** + * uuid: 05d5ede9-64a5-4678-b8ae-cf4c595dc824 + */ + #[TestDox('aces can start a straight flush (A 2 3 4 5)')] + public function testAcesCanStartAStraightFlush(): void + { + $hands = ['KS,AH,AS,AD,AC', '4H,AH,3H,2H,5H']; + $game = new Poker($hands); + + $this->assertEquals(['4H,AH,3H,2H,5H'], $game->bestHands); + } + + /** + * uuid: ad655466-6d04-49e8-a50c-0043c3ac18ff + */ + #[TestDox('aces cannot be in the middle of a straight flush (Q K A 2 3)')] + public function testAcesCannotBeInTheMiddleOfAStraightFlush(): void + { + $hands = ['2C,AC,QC,10C,KC', 'QH,KH,AH,2H,3H']; + $game = new Poker($hands); + + $this->assertEquals(['2C,AC,QC,10C,KC'], $game->bestHands); + } + + /** + * uuid: d0927f70-5aec-43db-aed8-1cbd1b6ee9ad + */ + #[TestDox('both hands have a straight flush, tie goes to highest-ranked card')] + public function testBothHandsHaveAStraightFlushTieGoesToHighestRankedCard(): void { $hands = ['4H,6H,7H,8H,5H', '5S,7S,8S,9S,6S']; $game = new Poker($hands); $this->assertEquals(['5S,7S,8S,9S,6S'], $game->bestHands); } + + /** + * uuid: be620e09-0397-497b-ac37-d1d7a4464cfc + */ + #[TestDox('even though an ace is usually high, a 5-high straight flush is the lowest-scoring straight flush')] + public function tesEvenThoughAnAceIsUsuallyHighAFivehighStraightFlushIsTheLowestScoringStraightFlush(): void + { + $hands = ['2H,3H,4H,5H,6H', '4D,AD,3D,2D,5D']; + $game = new Poker($hands); + + $this->assertEquals(['2H,3H,4H,5H,6H'], $game->bestHands); + } } From 99c77dbd6e3ca45997f151521c3fa5e771f117ca Mon Sep 17 00:00:00 2001 From: resu-xuniL Date: Sun, 5 Jul 2026 14:55:30 +0200 Subject: [PATCH 2/5] fix `example.php` --- exercises/practice/poker/.meta/example.php | 42 ++++++++++++++++++++-- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/exercises/practice/poker/.meta/example.php b/exercises/practice/poker/.meta/example.php index 695c53bae..19165cadd 100644 --- a/exercises/practice/poker/.meta/example.php +++ b/exercises/practice/poker/.meta/example.php @@ -5,6 +5,8 @@ class Poker { public array $bestHands = []; + private int $tie; + // The '..' prefix for card ranks allows for matching index -> value increasing readability. public const CARD_RANKS = '..23456789TJQKA'; public const CARD_SUITS = 'HSDC'; @@ -14,8 +16,41 @@ public function __construct(array $hands) $this->bestHands = $this->calculateBestHands($hands); } + private function sortRanks(string $hand): array + { + $cards = explode(",", $hand); + + usort($cards, function ($a, $b) { + return $b[0] <=> $a[0]; + }); + + return array_map(fn($card) => $card[0], $cards); + } + + private function seekTies(array $hands): int + { + $prevRanks = null; + + foreach ($hands as $hand) { + $ranks = $this->sortRanks($hand); + + if ($prevRanks !== null) { + for ($i = 0; $i < count($ranks); $i++) { + if ($ranks[$i] !== $prevRanks[$i]) { + return $i; + } + } + } + + $prevRanks = $ranks; + } + + return 0; + } + private function calculateBestHands(array $hands): array { + $this->tie = $this->seekTies($hands); $bestHands = []; $parsedHands = []; @@ -112,6 +147,7 @@ private function scoreHand(array $cards): Score //Normalize aces for low straights. if ($this->isEqualHandRanks([14, 2, 3, 4, 5], $ranks)) { $ranks = [5, 4, 3, 2, 1]; + $cardsByRank = $ranks; } $isFlush = count(array_unique($suits)) === 1; @@ -130,7 +166,7 @@ private function scoreHand(array $cards): Score } if ($isFlush) { - return new Score(500 + current($cardsByRank), 0); + return new Score(500 + current($cardsByRank), $cardsByRank[$this->tie]); } if ($isStraight) { @@ -146,10 +182,10 @@ private function scoreHand(array $cards): Score } if ($this->isEqualHandRanks($ranksByFreq, [2,1,1,1])) { - return new Score(100 + $cardsByRank[0], 0); + return new Score(100 + $cardsByRank[0], $cardsByRank[2]); } - return new Score(max($ranks), $cardsByRank[4]); + return new Score(max($ranks), $cardsByRank[$this->tie]); } private function isEqualHandRanks(array $handOne, array $handTwo): bool From d7f5d0f9f616901b577551245cdd8bf0dcfccaed Mon Sep 17 00:00:00 2001 From: resu-xuniL Date: Mon, 6 Jul 2026 18:22:46 +0200 Subject: [PATCH 3/5] Raise difficulty to 7 --- config.json | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/config.json b/config.json index 83bfd455e..541fcec3a 100644 --- a/config.json +++ b/config.json @@ -1209,19 +1209,6 @@ "transforming" ] }, - { - "slug": "poker", - "name": "Poker", - "uuid": "e8669c8e-bfdd-4207-baf6-23c2e4b12d13", - "practices": [], - "prerequisites": [], - "difficulty": 5, - "topics": [ - "games", - "parsing", - "sorting" - ] - }, { "slug": "robot-simulator", "name": "Robot Simulator", @@ -1347,6 +1334,19 @@ "transforming" ] }, + { + "slug": "poker", + "name": "Poker", + "uuid": "e8669c8e-bfdd-4207-baf6-23c2e4b12d13", + "practices": [], + "prerequisites": [], + "difficulty": 7, + "topics": [ + "games", + "parsing", + "sorting" + ] + }, { "slug": "zebra-puzzle", "name": "Zebra Puzzle", From cf7296a943366b1360b31d2878b488569cf60d19 Mon Sep 17 00:00:00 2001 From: resu-xuniL Date: Mon, 6 Jul 2026 19:10:34 +0200 Subject: [PATCH 4/5] Add comments for `enhancing the data encapsulation` --- exercises/practice/poker/Poker.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/exercises/practice/poker/Poker.php b/exercises/practice/poker/Poker.php index 5803209e4..394fc7bd4 100644 --- a/exercises/practice/poker/Poker.php +++ b/exercises/practice/poker/Poker.php @@ -26,6 +26,15 @@ class Poker { + /** + * In PHP 8.4 and newer, you can use to enhance data encapsulation: + * - Asymmetric Property Visibility + * @see https://www.php.net/manual/en/language.oop5.visibility.php#language.oop5.visibility-members-aviz + * Or: + * - Property hooks + * @see https://www.php.net/manual/en/language.oop5.property-hooks.php + */ + public array $bestHands = []; public function __construct(array $hands) From 1e54d4e6ea82b60863ff243d09065d7cc1589ca2 Mon Sep 17 00:00:00 2001 From: resu-xuniL Date: Tue, 7 Jul 2026 18:10:11 +0200 Subject: [PATCH 5/5] Capitalize first word in `PokerTest.php` --- exercises/practice/poker/PokerTest.php | 74 +++++++++++++------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/exercises/practice/poker/PokerTest.php b/exercises/practice/poker/PokerTest.php index a74f5bcf6..a86793de0 100644 --- a/exercises/practice/poker/PokerTest.php +++ b/exercises/practice/poker/PokerTest.php @@ -15,7 +15,7 @@ public static function setUpBeforeClass(): void /** * uuid: 161f485e-39c2-4012-84cf-bec0c755b66c */ - #[TestDox('single hand always wins')] + #[TestDox('Single hand always wins')] public function testSingleHandAlwaysWins(): void { $hands = ['4S,5S,7H,8D,JC']; @@ -27,7 +27,7 @@ public function testSingleHandAlwaysWins(): void /** * uuid: 370ac23a-a00f-48a9-9965-6f3fb595cf45 */ - #[TestDox('highest card out of all hands wins')] + #[TestDox('Highest card out of all hands wins')] public function testHighestCardOutOfAllHandsWins(): void { $hands = ['4D,5S,6S,8D,3C', '2S,4C,7S,9H,10H', '3S,4S,5D,6H,JH']; @@ -39,7 +39,7 @@ public function testHighestCardOutOfAllHandsWins(): void /** * uuid: d94ad5a7-17df-484b-9932-c64fc26cff52 */ - #[TestDox('a tie has multiple winners')] + #[TestDox('A tie has multiple winners')] public function testATieHasMultipleWinners(): void { $hands = ['4D,5S,6S,8D,3C', '2S,4C,7S,9H,10H', '3S,4S,5D,6H,JH', '3H,4H,5C,6C,JD']; @@ -51,7 +51,7 @@ public function testATieHasMultipleWinners(): void /** * uuid: 61ed83a9-cfaa-40a5-942a-51f52f0a8725 */ - #[TestDox('multiple hands with the same high cards, tie compares next highest ranked, down to last card')] + #[TestDox('Multiple hands with the same high cards, tie compares next highest ranked, down to last card')] public function testMultipleHandsWithTheSameHighCardsTieComparesNextHighestRankedDownToLastCard(): void { $hands = ['3S,5H,6S,8D,7H', '2S,5D,6D,8C,7S']; @@ -63,7 +63,7 @@ public function testMultipleHandsWithTheSameHighCardsTieComparesNextHighestRanke /** * uuid: da01becd-f5b0-4342-b7f3-1318191d0580 */ - #[TestDox('winning high card hand also has the lowest card')] + #[TestDox('Winning high card hand also has the lowest card')] public function testWinningHighCardHandAlsoHasTheLowestCard(): void { $hands = ['2S,5H,6S,8D,7H', '3S,4D,6D,8C,7S']; @@ -75,7 +75,7 @@ public function testWinningHighCardHandAlsoHasTheLowestCard(): void /** * uuid: f7175a89-34ff-44de-b3d7-f6fd97d1fca4 */ - #[TestDox('one pair beats high card')] + #[TestDox('One pair beats high card')] public function testOnePairBeatsHighCard(): void { $hands = ['4S,5H,6C,8D,KH', '2S,4H,6S,4D,JH']; @@ -87,7 +87,7 @@ public function testOnePairBeatsHighCard(): void /** * uuid: e114fd41-a301-4111-a9e7-5a7f72a76561 */ - #[TestDox('highest pair wins')] + #[TestDox('Highest pair wins')] public function testHighestPairWins(): void { $hands = ['4S,2H,6S,2D,JH', '2S,4H,6C,4D,JD']; @@ -99,7 +99,7 @@ public function testHighestPairWins(): void /** * uuid: b3acd3a7-f9fa-4647-85ab-e0a9e07d1365 */ - #[TestDox('both hands have the same pair, high card wins')] + #[TestDox('Both hands have the same pair, high card wins')] public function testBothHandsHaveTheSamePairHighCardWins(): void { $hands = ['4H,4S,AH,JC,3D', '4C,4D,AS,5D,6C']; @@ -111,7 +111,7 @@ public function testBothHandsHaveTheSamePairHighCardWins(): void /** * uuid: 935bb4dc-a622-4400-97fa-86e7d06b1f76 */ - #[TestDox('two pairs beats one pair')] + #[TestDox('Two pairs beats one pair')] public function testTwoPairsBeatsOnePair(): void { $hands = ['2S,8H,6S,8D,JH', '4S,5H,4C,8C,5C']; @@ -123,7 +123,7 @@ public function testTwoPairsBeatsOnePair(): void /** * uuid: c8aeafe1-6e3d-4711-a6de-5161deca91fd */ - #[TestDox('both hands have two pairs, highest ranked pair wins')] + #[TestDox('Both hands have two pairs, highest ranked pair wins')] public function testBothHandsHaveTwoPairsHighestRankedPairWins(): void { $hands = ['2S,8H,2D,8D,3H', '4S,5H,4C,8S,5D']; @@ -135,7 +135,7 @@ public function testBothHandsHaveTwoPairsHighestRankedPairWins(): void /** * uuid: 88abe1ba-7ad7-40f3-847e-0a26f8e46a60 */ - #[TestDox('both hands have two pairs, with the same highest ranked pair, tie goes to low pair')] + #[TestDox('Both hands have two pairs, with the same highest ranked pair, tie goes to low pair')] public function testBothHandsHaveTwoPairsWithTheSameHighestRankedPairTieGoesToLowPair(): void { $hands = ['2S,QS,2C,QD,JH', 'JD,QH,JS,8D,QC']; @@ -147,7 +147,7 @@ public function testBothHandsHaveTwoPairsWithTheSameHighestRankedPairTieGoesToLo /** * uuid: 15a7a315-0577-47a3-9981-d6cf8e6f387b */ - #[TestDox('both hands have two identically ranked pairs, tie goes to remaining card (kicker)')] + #[TestDox('Both hands have two identically ranked pairs, tie goes to remaining card (kicker)')] public function testBothHandsHaveTwoIdenticallyRankedPairsTieGoesToRemainingCard(): void { $hands = ['JD,QH,JS,8D,QC', 'JS,QS,JC,2D,QD']; @@ -159,7 +159,7 @@ public function testBothHandsHaveTwoIdenticallyRankedPairsTieGoesToRemainingCard /** * uuid: f761e21b-2560-4774-a02a-b3e9366a51ce */ - #[TestDox('both hands have two pairs that add to the same value, win goes to highest pair')] + #[TestDox('Both hands have two pairs that add to the same value, win goes to highest pair')] public function testBotHandsHaveTwoPairsThatAddToTheSameValueWinGoesToHighestPair() { $hands = ['6S,6H,3S,3H,AS', '7H,7S,2H,2S,AC']; @@ -171,7 +171,7 @@ public function testBotHandsHaveTwoPairsThatAddToTheSameValueWinGoesToHighestPai /** * uuid: fc6277ac-94ac-4078-8d39-9d441bc7a79e */ - #[TestDox('two pairs first ranked by largest pair')] + #[TestDox('Two pairs first ranked by largest pair')] public function testTwoPairsFirstRankedByLargestPair() { $hands = ["5C,2S,5S,4H,4C", "6S,2S,6H,7C,2C"]; @@ -183,7 +183,7 @@ public function testTwoPairsFirstRankedByLargestPair() /** * uuid: 21e9f1e6-2d72-49a1-a930-228e5e0195dc */ - #[TestDox('three of a kind beats two pair')] + #[TestDox('Three of a kind beats two pair')] public function testThreeOfAKindBeatsTwoPair(): void { $hands = ['2S,8H,2H,8D,JH', '4S,5H,4C,8S,4H']; @@ -195,7 +195,7 @@ public function testThreeOfAKindBeatsTwoPair(): void /** * uuid: c2fffd1f-c287-480f-bf2d-9628e63bbcc3 */ - #[TestDox('both hands have three of a kind, tie goes to highest ranked triplet')] + #[TestDox('Both hands have three of a kind, tie goes to highest ranked triplet')] public function testBothHandsHaveThreeOfAKindTieGoesToHighestRankedTriplet(): void { $hands = ['2S,2H,2C,8D,JH', '4S,AH,AS,8C,AD']; @@ -209,7 +209,7 @@ public function testBothHandsHaveThreeOfAKindTieGoesToHighestRankedTriplet(): vo * * uuid: 26a4a7d4-34a2-4f18-90b4-4a8dd35d2bb1 */ - #[TestDox('with multiple decks, two players can have same three of a kind, ties go to highest remaining cards')] + #[TestDox('With multiple decks, two players can have same three of a kind, ties go to highest remaining cards')] public function testWithMultipleDecksTwoPlayersCanHaveSameThreeOfAKindTiesGoToHighestRemainingCards(): void { $hands = ['5S,AH,AS,7C,AD', '4S,AH,AS,8C,AD']; @@ -221,7 +221,7 @@ public function testWithMultipleDecksTwoPlayersCanHaveSameThreeOfAKindTiesGoToHi /** * uuid: a858c5d9-2f28-48e7-9980-b7fa04060a60 */ - #[TestDox('a straight beats three of a kind')] + #[TestDox('A straight beats three of a kind')] public function testStraightBeatsThreeOfAKind(): void { $hands = ['4S,5H,4C,8D,4H', '3S,4D,2S,6D,5C']; @@ -233,7 +233,7 @@ public function testStraightBeatsThreeOfAKind(): void /** * uuid: 73c9c756-e63e-4b01-a88d-0d4491a7a0e3 */ - #[TestDox('aces can end a straight (10 J Q K A)')] + #[TestDox('Aces can end a straight (10 J Q K A)')] public function testAcesCanEndAStraight(): void { $hands = ['4S,5H,4C,8D,4H', '10D,JH,QS,KD,AC']; @@ -245,7 +245,7 @@ public function testAcesCanEndAStraight(): void /** * uuid: 76856b0d-35cd-49ce-a492-fe5db53abc02 */ - #[TestDox('aces can start a straight (A 2 3 4 5)')] + #[TestDox('Aces can start a straight (A 2 3 4 5)')] public function testAcesCanStartAStraight(): void { $hands = ['4S,5H,4C,8D,4H', '4D,AH,3S,2D,5C']; @@ -257,7 +257,7 @@ public function testAcesCanStartAStraight(): void /** * uuid: e214b7df-dcba-45d3-a2e5-342d8c46c286 */ - #[TestDox('aces cannot be in the middle of a straight (Q K A 2 3)')] + #[TestDox('Aces cannot be in the middle of a straight (Q K A 2 3)')] public function testAcesCannotBeInTheMiddleOfAStraight(): void { $hands = ['2C,3D,7H,5H,2S', 'QS,KH,AC,2D,3S']; @@ -269,7 +269,7 @@ public function testAcesCannotBeInTheMiddleOfAStraight(): void /** * uuid: 6980c612-bbff-4914-b17a-b044e4e69ea1 */ - #[TestDox('both hands with a straight, tie goes to highest ranked card')] + #[TestDox('Both hands with a straight, tie goes to highest ranked card')] public function testBothHandsWithAStraightTieGoesToHighestRankedCard(): void { $hands = ['4S,6C,7S,8D,5H', '5S,7H,8S,9D,6H']; @@ -281,7 +281,7 @@ public function testBothHandsWithAStraightTieGoesToHighestRankedCard(): void /** * uuid: 5135675c-c2fc-4e21-9ba3-af77a32e9ba4 */ - #[TestDox('even though an ace is usually high, a 5-high straight is the lowest-scoring straight')] + #[TestDox('Even though an ace is usually high, a 5-high straight is the lowest-scoring straight')] public function testEvenThoughAnAceIsUsuallyHighAFiveHighStraightIsTheLowestScoringStraight(): void { $hands = ['2H,3C,4D,5D,6H', '4S,AH,3S,2D,5H']; @@ -293,7 +293,7 @@ public function testEvenThoughAnAceIsUsuallyHighAFiveHighStraightIsTheLowestScor /** * uuid: c601b5e6-e1df-4ade-b444-b60ce13b2571 */ - #[TestDox('flush beats a straight')] + #[TestDox('Flush beats a straight')] public function testFlushBeatsAStraight(): void { $hands = ['4C,6H,7D,8D,5H', '2S,4S,5S,6S,7S']; @@ -307,7 +307,7 @@ public function testFlushBeatsAStraight(): void * * uuid: e04137c5-c19a-4dfc-97a1-9dfe9baaa2ff */ - #[TestDox('both hands have a flush, tie goes to high card, down to the last one if necessary')] + #[TestDox('Both hands have a flush, tie goes to high card, down to the last one if necessary')] public function testBothHandsHaveAFlushTieGoesToHighCardDownToTheLastOneIfNecessary(): void { $hands = ['2H,7H,8H,9H,6H', '3S,5S,6S,7S,8S']; @@ -319,7 +319,7 @@ public function testBothHandsHaveAFlushTieGoesToHighCardDownToTheLastOneIfNecess /** * uuid: 3a19361d-8974-455c-82e5-f7152f5dba7c */ - #[TestDox('full house beats a flush')] + #[TestDox('Full house beats a flush')] public function testFullHouseBeatsAFlush(): void { $hands = ['3H,6H,7H,8H,5H', '4S,5H,4C,5D,4H']; @@ -331,7 +331,7 @@ public function testFullHouseBeatsAFlush(): void /** * uuid: eb73d0e6-b66c-4f0f-b8ba-bf96bc0a67f0 */ - #[TestDox('both hands have a full house, tie goes to highest-ranked triplet')] + #[TestDox('Both hands have a full house, tie goes to highest-ranked triplet')] public function testBothHandsHaveAFullHouseTieGoesToHighestRankedTriplet(): void { $hands = ['4H,4S,4D,9S,9D', '5H,5S,5D,8S,8D']; @@ -343,7 +343,7 @@ public function testBothHandsHaveAFullHouseTieGoesToHighestRankedTriplet(): void /** * uuid: e34b51168-1e43-4c0d-9b32-e356159b4d5d */ - #[TestDox('with multiple decks, both hands have a full house with the same triplet, tie goes to the pair')] + #[TestDox('With multiple decks, both hands have a full house with the same triplet, tie goes to the pair')] public function testWithMultipleDecksBothHandsHaveAFullHouseWithTheSameTripletTieGoesToThePair(): void { $hands = ['5H,5S,5D,9S,9D', '5H,5S,5D,8S,8D']; @@ -355,7 +355,7 @@ public function testWithMultipleDecksBothHandsHaveAFullHouseWithTheSameTripletTi /** * uuid: d61e9e99-883b-4f99-b021-18f0ae50c5f4 */ - #[TestDox('four of a kind beats a full house')] + #[TestDox('Four of a kind beats a full house')] public function testFourOfAKindBeatsAFullHouse(): void { $hands = ['4S,5H,4D,5D,4H', '3S,3H,2S,3D,3C']; @@ -367,7 +367,7 @@ public function testFourOfAKindBeatsAFullHouse(): void /** * uuid: 2e1c8c63-e0cb-4214-a01b-91954490d2fe */ - #[TestDox('both hands have four of a kind, tie goes to high quad')] + #[TestDox('Both hands have four of a kind, tie goes to high quad')] public function testBothHandsHaveFourOfAKindTieGoesToHighQuad(): void { $hands = ['2S,2H,2C,8D,2D', '4S,5H,5S,5D,5C']; @@ -379,7 +379,7 @@ public function testBothHandsHaveFourOfAKindTieGoesToHighQuad(): void /** * uuid: 892ca75d-5474-495d-9f64-a6ce2dcdb7e1 */ - #[TestDox('with multiple decks, both hands with identical four of a kind, tie determined by kicker')] + #[TestDox('With multiple decks, both hands with identical four of a kind, tie determined by kicker')] public function testWithMultipleDecksBothHandsWithIdenticalFourOfAKindTieDeterminedByKicker(): void { $hands = ['3S,3H,2S,3D,3C', '3S,3H,4S,3D,3C']; @@ -391,7 +391,7 @@ public function testWithMultipleDecksBothHandsWithIdenticalFourOfAKindTieDetermi /** * uuid: 923bd910-dc7b-4f7d-a330-8b42ec10a3ac */ - #[TestDox('straight flush beats four of a kind')] + #[TestDox('Straight flush beats four of a kind')] public function testStraightFlushBeatsFourOfAKind(): void { $hands = ['4S,5H,5S,5D,5C', '7S,8S,9S,6S,10S']; @@ -403,7 +403,7 @@ public function testStraightFlushBeatsFourOfAKind(): void /** * uuid: d9629e22-c943-460b-a951-2134d1b43346 */ - #[TestDox('aces can end a straight flush (10 J Q K A)')] + #[TestDox('Aces can end a straight flush (10 J Q K A)')] public function testAcesCanEndAStraightFlush(): void { $hands = ['KC,AH,AS,AD,AC', '10C,JC,QC,KC,AC']; @@ -415,7 +415,7 @@ public function testAcesCanEndAStraightFlush(): void /** * uuid: 05d5ede9-64a5-4678-b8ae-cf4c595dc824 */ - #[TestDox('aces can start a straight flush (A 2 3 4 5)')] + #[TestDox('Aces can start a straight flush (A 2 3 4 5)')] public function testAcesCanStartAStraightFlush(): void { $hands = ['KS,AH,AS,AD,AC', '4H,AH,3H,2H,5H']; @@ -427,7 +427,7 @@ public function testAcesCanStartAStraightFlush(): void /** * uuid: ad655466-6d04-49e8-a50c-0043c3ac18ff */ - #[TestDox('aces cannot be in the middle of a straight flush (Q K A 2 3)')] + #[TestDox('Aces cannot be in the middle of a straight flush (Q K A 2 3)')] public function testAcesCannotBeInTheMiddleOfAStraightFlush(): void { $hands = ['2C,AC,QC,10C,KC', 'QH,KH,AH,2H,3H']; @@ -439,7 +439,7 @@ public function testAcesCannotBeInTheMiddleOfAStraightFlush(): void /** * uuid: d0927f70-5aec-43db-aed8-1cbd1b6ee9ad */ - #[TestDox('both hands have a straight flush, tie goes to highest-ranked card')] + #[TestDox('Both hands have a straight flush, tie goes to highest-ranked card')] public function testBothHandsHaveAStraightFlushTieGoesToHighestRankedCard(): void { $hands = ['4H,6H,7H,8H,5H', '5S,7S,8S,9S,6S']; @@ -451,7 +451,7 @@ public function testBothHandsHaveAStraightFlushTieGoesToHighestRankedCard(): voi /** * uuid: be620e09-0397-497b-ac37-d1d7a4464cfc */ - #[TestDox('even though an ace is usually high, a 5-high straight flush is the lowest-scoring straight flush')] + #[TestDox('Even though an ace is usually high, a 5-high straight flush is the lowest-scoring straight flush')] public function tesEvenThoughAnAceIsUsuallyHighAFivehighStraightFlushIsTheLowestScoringStraightFlush(): void { $hands = ['2H,3H,4H,5H,6H', '4D,AD,3D,2D,5D'];