87 lines
3.2 KiB
Plaintext
87 lines
3.2 KiB
Plaintext
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Problem Name (Euler Problem 54)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {
|
||
|
"collapsed": true
|
||
|
},
|
||
|
"source": [
|
||
|
"In the card game poker, a hand consists of five cards and are ranked, from lowest to highest, in the following way:\n",
|
||
|
"\n",
|
||
|
"* High Card: Highest value card.\n",
|
||
|
"* One Pair: Two cards of the same value.\n",
|
||
|
"* Two Pairs: Two different pairs.\n",
|
||
|
"* Three of a Kind: Three cards of the same value.\n",
|
||
|
"* Straight: All cards are consecutive values.\n",
|
||
|
"* Flush: All cards of the same suit.\n",
|
||
|
"* Full House: Three of a kind and a pair.\n",
|
||
|
"* Four of a Kind: Four cards of the same value.\n",
|
||
|
"* Straight Flush: All cards are consecutive values of same suit.\n",
|
||
|
"* Royal Flush: Ten, Jack, Queen, King, Ace, in same suit.\n",
|
||
|
"* The cards are valued in the order:\n",
|
||
|
"* 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King, Ace.\n",
|
||
|
"\n",
|
||
|
"If two players have the same ranked hands then the rank made up of the highest value wins; for example, a pair of eights beats a pair of fives (see example 1 below). But if two ranks tie, for example, both players have a pair of queens, then highest cards in each hand are compared (see example 4 below); if the highest cards tie then the next highest cards are compared, and so on.\n",
|
||
|
"\n",
|
||
|
"Consider the following five hands dealt to two players:\n",
|
||
|
"\n",
|
||
|
"| Hand | \tPlayer 1\t|\tPlayer 2\t| \tWinner |\n",
|
||
|
"|------|------------|-----------|----------|\n",
|
||
|
"| 1\t | \t5H 5C 6S 7S KD Pair of Fives | 2C 3S 8S 8D TD Pair of Eights | Player 2 |\n",
|
||
|
"| 2\t | \t5D 8C 9S JS AC Highest card Ace | 2C 5C 7D 8S QH Highest card Queen | Player 1 |\n",
|
||
|
"| 3\t | \t2D 9C AS AH AC Three Aces | 3D 6D 7D TD QD Flush with Diamonds | Player 2 |\n",
|
||
|
"| 4\t | \t4D 6S 9H QH QC Pair of Queens Highest card Nine | 3D 6D 7H QD QS Pair of Queens Highest card Seven | Player 1 |\n",
|
||
|
"| 5\t | \t2H 2D 4C 4D 4S Full House With Three Fours | 3C 3D 3S 9S 9D Full House with Three Threes | Player 1 |\n",
|
||
|
"\n",
|
||
|
"The file, poker.txt, contains one-thousand random hands dealt to two players.\n",
|
||
|
"Each line of the file contains ten cards (separated by a single space): the\n",
|
||
|
"first five are Player 1's cards and the last five are Player 2's cards. You can\n",
|
||
|
"assume that all hands are valid (no invalid characters or repeated cards), each\n",
|
||
|
"player's hand is in no specific order, and in each hand there is a clear\n",
|
||
|
"winner.\n",
|
||
|
"\n",
|
||
|
"How many hands does Player 1 win?\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"metadata": {
|
||
|
"collapsed": true
|
||
|
},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"completion_date": "",
|
||
|
"kernelspec": {
|
||
|
"display_name": "Python 3",
|
||
|
"language": "python3.6",
|
||
|
"name": "python3"
|
||
|
},
|
||
|
"language_info": {
|
||
|
"codemirror_mode": {
|
||
|
"name": "ipython",
|
||
|
"version": 3
|
||
|
},
|
||
|
"file_extension": ".py",
|
||
|
"mimetype": "text/x-python",
|
||
|
"name": "python",
|
||
|
"nbconvert_exporter": "python",
|
||
|
"pygments_lexer": "ipython3",
|
||
|
"version": "3.6.5"
|
||
|
},
|
||
|
"tags": []
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 2
|
||
|
}
|