2.6 KiB
id | challengeType | title |
---|---|---|
5900f3a21000cf542c50feb5 | 5 | Problem 54: Poker hands |
Description
Hand Player 1 Player 2 Winner 1 5H 5C 6S 7S KDPair of Fives 2C 3S 8S 8D TDPair of Eights Player 2 2 5D 8C 9S JS ACHighest card Ace 2C 5C 7D 8S QHHighest card Queen Player 1 3 2D 9C AS AH ACThree Aces 3D 6D 7D TD QDFlush with Diamonds Player 2 4 4D 6S 9H QH QCPair of QueensHighest card Nine 3D 6D 7H QD QSPair of QueensHighest card Seven Player 1 5 2H 2D 4C 4D 4SFull HouseWith Three Fours 3C 3D 3S 9S 9DFull Housewith Three Threes Player 1
The file, poker.txt, contains one-thousand random hands dealt to two players. Each line of the file contains ten cards (separated by a single space): the first five are Player 1's cards and the last five are Player 2's cards. You can assume that all hands are valid (no invalid characters or repeated cards), each player's hand is in no specific order, and in each hand there is a clear winner. How many hands does Player 1 win?
Instructions
Tests
tests:
- text: <code>euler54()</code> should return 376.
testString: assert.strictEqual(euler54(), 376, '<code>euler54()</code> should return 376.');
Challenge Seed
function euler54() {
// Good luck!
return true;
}
euler54();
Solution
// solution required