Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- # Texas Hold'em Poker Starting Hands Simulator.
- # 9 Handed Table.
- # Output info : Every player's number of times when starting hands meet a specific criteria
- # Written in Python 3.5.1
- # Credits : Dolinta Mihai @ hs2000@inbox.ru
- # All % calculations are for 1.000.000 hands
- # Criteria 1 = Any suited Ace..................... ~ 3.60% Stability after 600 hands
- # Criteria 2 = Pocket Aces........................ ~ 0.45% Slight instability after 15000 hands
- # Criteria 3 = Any suited 2 cards................. ~ 23.50% Slight instability after 100 hands
- # Criteria 4 = Any suited connectors.............. ~ 3.92% Good stability after 1000 hands
- # Criteria 5 = Any suited & unsuited connectors... ~ 15.69% Slight instability after 2200 hands
- p1cc = 0
- p2cc = 0
- p3cc = 0
- p4cc = 0
- p5cc = 0
- p6cc = 0
- p7cc = 0
- p8cc = 0
- p9cc = 0
- pcc = [p1cc, p2cc, p3cc, p4cc, p5cc, p6cc, p7cc, p8cc, p9cc]
- rank = ["2", "3", "4", "5", "6", "7", "8", "9", "T", "J", "Q", "K", "A"]
- color = ["h", "d", "s", "c"]
- # Change range from 1 to 1000000, this represents the number of hands dealt to all players
- # If range is higher than 2, u may want to comment whole function that show players hands (Before 1. Function)
- for i in range(2):
- bannedcards = []
- player1 = []
- player2 = []
- player3 = []
- player4 = []
- player5 = []
- player6 = []
- player7 = []
- player8 = []
- player9 = []
- players = [player1, player2, player3, player4, player5, player6, player7, player8, player9]
- def dealcardtoplayers(player, banned, rank, color):
- cardrank = random.choice(rank)
- cardcolor = random.choice(color)
- card = cardrank + cardcolor
- if card not in banned:
- player.append(card)
- banned.append(card)
- else:
- dealcardtoplayers(player, banned, rank, color)
- return
- for cards in "12":
- for player in players:
- dealcardtoplayers(player, bannedcards, rank, color)
- Player1cards = ""
- Player2cards = ""
- Player3cards = ""
- Player4cards = ""
- Player5cards = ""
- Player6cards = ""
- Player7cards = ""
- Player8cards = ""
- Player9cards = ""
- Playercards = [Player1cards, Player2cards, Player3cards, Player4cards, Player5cards, Player6cards, Player7cards, Player8cards, Player9cards]
- for player in players:
- for card in player:
- Playercards[players.index(player)] = Playercards[players.index(player)] + card
- #Don't uncomment this with iteration range higher than 2
- #for players in Playercards:
- # print("Player" + str(Playercards.index(players)+1) + "'s cards are : " + players)
- # 1. Function that calculates how much times players hit any suited Ace combinations
- #def criteriacount(Playercards, pcc, rank, color):
- # for players in Playercards:
- # if players[0] == "A" or players[2] == "A":
- # if players[1] == players[3]:
- # pcc[Playercards.index(players)] = pcc[Playercards.index(players)] + 1
- # 2. Function that calculates how much times players hit pocket Aces combination
- #def criteriacount(Playerscards, pcc, rank, color):
- # for players in Playercards:
- # if players[0] == "A" and players[2] == "A":
- # pcc[Playercards.index(players)] = pcc[Playercards.index(players)] + 1
- # 3. Function that calculates how much times players hit any 2 suited cards combination
- #def criteriacount(Playerscards, pcc, rank, color):
- # for players in Playercards:
- # if players[1] == players[3]:
- # pcc[Playercards.index(players)] = pcc[Playercards.index(players)] + 1
- # 4. Function that calculates how much times players hit any suited connector combination
- #def criteriacount(Playercards, pcc, rank, color):
- # for players in Playercards:
- # if players[1] == players[3]:
- # c1 = players[0]
- # c2 = players[2]
- # if rank.index(c1) - rank.index(c2) == -1 or rank.index(c1) - rank.index(c2) == 1 or rank.index(c1) - rank.index(c2) == -12 or rank.index(c1) - rank.index(c2) == 12:
- # pcc[Playercards.index(players)] = pcc[Playercards.index(players)] + 1
- # 5. Function that calculates how much times players hit any unsuited connector combination
- #def criteriacount(Playercards, pcc, rank, color):
- # for players in Playercards:
- # c1 = players[0]
- # c2 = players[2]
- # if rank.index(c1) - rank.index(c2) == -1 or rank.index(c1) - rank.index(c2) == 1 or rank.index(c1) - rank.index(c2) == -12 or rank.index(c1) - rank.index(c2) == 12:
- # pcc[Playercards.index(players)] = pcc[Playercards.index(players)] + 1
- #
- criteriacount(Playercards, pcc, rank, color)
- for i in range(len(pcc)):
- print(str(pcc[i]))
Add Comment
Please, Sign In to add comment