-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
159 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 13, | ||
"id": "32c51d6f", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import itertools as it\n", | ||
"from itertools import combinations\n", | ||
"from itertools import permutations\n", | ||
"import sys" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"id": "ed15e034", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"ranks = ['A','K','Q','J','1','9','8','7','6','5','4','3','2'] #1 is 10\n", | ||
"suits = ['c','d','h','s']\n", | ||
"deck = []\n", | ||
"\n", | ||
"deck = [rank+suit for suit in suits for rank in ranks]" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"id": "d2118b6c", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"['Ac', 'Kc', 'Qc', 'Jc', '1c', '9c', '8c', '7c', '6c', '5c', '4c', '3c', '2c', 'Ad', 'Kd', 'Qd', 'Jd', '1d', '9d', '8d', '7d', '6d', '5d', '4d', '3d', '2d', 'Ah', 'Kh', 'Qh', 'Jh', '1h', '9h', '8h', '7h', '6h', '5h', '4h', '3h', '2h', 'As', 'Ks', 'Qs', 'Js', '1s', '9s', '8s', '7s', '6s', '5s', '4s', '3s', '2s']\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"print(deck)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"id": "da603e9e", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"hands = list(combinations(deck, 2))" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 5, | ||
"id": "b31a1140", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"1326" | ||
] | ||
}, | ||
"execution_count": 5, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"len(hands)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 6, | ||
"id": "5ff0d535", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"\n", | ||
"# boards = list(permutations(deck, 5)) len(boards) = 311 875 200 unique permutations of boards\n", | ||
"\n", | ||
"flops = list(combinations(deck, 3))\n", | ||
"boards = list()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "20906a10", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 7, | ||
"id": "fc8c1438", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"for flop in flops:\n", | ||
" deck = ['As', 'Ks', 'Qs', 'Js', '1s', '9s', '8s', '7s', '6s', '5s', '4s', '3s', '2s', 'Ac', 'Kc', 'Qc', 'Jc', '1c', '9c', '8c', '7c', '6c', '5c', '4c', '3c', '2c', 'Ah', 'Kh', 'Qh', 'Jh', '1h', '9h', '8h', '7h', '6h', '5h', '4h', '3h', '2h', 'Ad', 'Kd', 'Qd', 'Jd', '1d', '9d', '8d', '7d', '6d', '5d', '4d', '3d', '2d']\n", | ||
" deck.remove(flop[0])\n", | ||
" deck.remove(flop[1])\n", | ||
" deck.remove(flop[2])\n", | ||
" turn_river = permutations(deck,2)\n", | ||
" for tr in turn_river:\n", | ||
" boards += [flop + tr]" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 14, | ||
"id": "0c34bb37", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"with open('out.csv', 'w') as f:\n", | ||
" print(boards, file=f)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "7ec4eec0", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"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.9.12" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |