Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- # Define ranges
- ranges = {
- "Open Raise": {
- "LJ": ["77+", "ATs+", "KTs+", "QTs+", "JTs", "T9s", "98s", "87s", "AJo+", "KQo"],
- "HJ": ["22+", "A2s+", "KTs+", "QTs+", "J9s+", "T9s", "98s", "87s", "76s", "65s", "54s", "ATo+", "KJo+"],
- "CO": ["22+", "A2s+", "K3s+", "Q6s+", "J7s+", "T7s+", "97s+", "86s+", "75s+", "64s+", "54s", "A9o+", "KTo+", "QTo+", "JTo"],
- "BU": ["22+", "A2s+", "K2s+", "Q2s+", "J4s+", "T5s+", "95s+", "85s+", "74s+", "63s+", "53s+", "43s", "A2o+", "K7o+", "Q9o+", "J9o+", "T9o", "98o"],
- "SB": ["22+", "A2s+", "K2s+", "Q2s+", "J4s+", "T5s+", "95s+", "85s+", "74s+", "63s+", "53s+", "43s", "A2o+", "K7o+", "Q9o+", "J9o+", "T9o", "98o"]
- },
- "IsoRaise": {
- "HJ": ["22+", "A2s+", "KTs+", "QTs+", "JTs", "T9s", "ATo+", "KJo+"],
- "CO": ["22+", "A2s+", "K9s+", "Q9s+", "J9s+", "T9s", "98s", "87s", "ATo+", "KTo+"],
- "BU": ["22+", "A2s+", "KTs+", "QTs+", "JTs", "T9s", "98s", "87s", "ATo+", "KTo+"],
- "SB": ["99+", "ATs+", "KTs+", "QTs+", "JTs", "ATo+", "KQo"],
- "BB": ["99+", "ATs+", "KTs+", "QTs+", "JTs", "ATo+", "KQo"]
- },
- "3bet": {
- "LJ": ["QQ+", "AKo", "AKs"],
- "HJ": ["JJ+", "AKo", "AKs"],
- "CO": ["JJ+", "AJs+", "KQs", "AQo+"],
- },
- "3bet vs Non Steal": {
- "BU": ["99+", "ATs+", "KTs+", "QTs+", "JTs", "AQo+"],
- "SB": ["99+", "ATs+", "KTs+", "QTs+", "JTs", "AJo+", "KQo"],
- "BB": ["JJ+", "AQs+", "AKo"]
- },
- "3bet vs Steal": {
- "BU": ["88+", "A5s-A2s", "KTs+", "QTs+", "JTs", "T9s", "98s", "87s", "76s", "65s", "54s", "AJo+", "KQo"],
- "SB": ["99+", "ATs+", "KTs+", "QTs+", "JTs", "AJo+", "KQo"],
- "BB": ["TT+", "ATs+", "KJs+", "QTs+", "J9s+", "T9s", "AKo"]
- },
- "Call vs 3b IP": {
- "LJ": ["JJ", "AQo", "AQs"],
- "HJ": ["JJ", "AQs-AJs", "KQs", "AQo"],
- "CO": ["JJ-77", "AQs-ATs", "KTs+", "QTs+", "JTs", "T9s", "98s", "87s", "AQo"],
- "BU": ["JJ-55", "AQs-A2s", "K9s+", "Q9s+", "J9s+", "T9s", "98s", "87s", "76s", "65s", "AQo-AJo", "KQo"]
- },
- "4Bet Bluff OOP": {
- "LJ": ["AQs", "KQs", "AQo"],
- "HJ": ["AQs-AJs", "KQs", "AQo"],
- "CO": ["JJ-TT", "AQs-AJs", "KQs", "AQo"],
- "SB": ["JJ-TT", "AQs-AJs", "KJs+", "AQo-AJo", "KQo"]
- },
- "Cold Call vs Non Steal": {
- "BB": ["TT-22", "AJs-A2s", "KQs-K5s", "Q6s+", "J7s+", "T8s+", "97s+", "86s+", "76s", "65s", "54s", "AQo-ATo", "KQo"]
- },
- "Cold Call vs Steal": {
- "BB": ["99-22", "A9s-A2s", "K9s-K5s", "Q9s-Q6s", "J9s-J7s", "T7s+", "97s+", "86s+", "76s", "65s", "54s", "AQo-ATo", "KJo-KTo", "QTo+", "JTo"]
- },
- "4bet": {
- "LJ": ["QQ+", "AKo", "AKs"],
- "HJ": ["QQ+", "AKo", "AKs"],
- "CO": ["QQ+", "AKo", "AKs"],
- "BU": ["QQ+", "AKo", "AKs"],
- "SB": ["QQ+", "AKo", "AKs"],
- "BB": ["QQ+", "AKo", "AKs"],
- },
- "All-In": {
- "LJ": ["QQ+", "AKo", "AKs"],
- "HJ": ["QQ+", "AKo", "AKs"],
- "CO": ["QQ+", "AKo", "AKs"],
- "BU": ["QQ+", "AKo", "AKs"],
- "SB": ["QQ+", "AKo", "AKs"],
- "BB": ["QQ+", "AKo", "AKs"],
- }
- }
- value_order = "23456789TJQKA"
- def clear_screen():
- os.system('cls' if os.name == 'nt' else 'clear')
- def generate_full_range(hand_range):
- result = []
- if hand_range[-1] == '+':
- base_rank = hand_range[:-1]
- if len(base_rank) == 2: # Pocket pairs
- start_index = value_order.index(base_rank[0])
- result.extend([value_order[i] + value_order[i] for i in range(start_index, len(value_order))])
- else: # Suited or Offsuit hands
- start_rank = base_rank[0]
- suit_type = base_rank[2]
- start_index = value_order.index(base_rank[1])
- if suit_type == 's':
- result.extend([start_rank + value_order[i] + 'S' for i in range(start_index, len(value_order)) if start_rank != value_order[i]])
- elif suit_type == 'o':
- result.extend([start_rank + value_order[i] + 'O' for i in range(start_index, len(value_order)) if start_rank != value_order[i]])
- elif '-' in hand_range:
- upper, lower = hand_range.split('-')
- if len(lower) == 2 and len(upper) == 2: # Pocket pairs
- lower_index = value_order.index(lower[0])
- upper_index = value_order.index(upper[0])
- result.extend([value_order[i] + value_order[i] for i in range(lower_index, upper_index + 1)])
- else: # Suited or Offsuit hands
- lower_rank = lower[0]
- suit = lower[2]
- lower_index = value_order.index(lower[1])
- upper_index = value_order.index(upper[1])
- result.extend([lower_rank + value_order[i] + suit.upper() for i in range(lower_index, upper_index + 1)])
- else:
- result.append(hand_range)
- return result
- def hand_in_range(hand, range_list):
- for range_hand in range_list:
- full_range = generate_full_range(range_hand)
- if hand in full_range:
- return True
- return False
- def get_related_actions(action):
- if action in ["Open Raise", "IsoRaise", "3bet vs Non Steal", "3bet vs Steal", "3bet"]:
- return ["Open Raise", "IsoRaise", "3bet vs Non Steal", "3bet vs Steal", "3bet"]
- elif action in ["4Bet Bluff OOP", "4bet"]:
- return ["4Bet Bluff OOP", "4bet"]
- elif action in ["Call vs 3b IP", "Cold Call vs Non Steal", "Cold Call vs Steal"]:
- return ["Call vs 3b IP", "Cold Call vs Non Steal", "Cold Call vs Steal"]
- else:
- return []
- def handle_chosen_action(hole_cards, position):
- # Determine if facing LJ open
- is_facing_lj_open = input("Are you facing a LJ open? (y/n): ").lower() == 'y'
- available_actions = get_possible_actions(hole_cards, position, is_facing_lj_open)
- chosen_actions = []
- def is_pocket_pair(hand):
- return hand[0] == hand[1] and len(hand) == 2
- def is_suited_connector(hand):
- if len(hand) == 3 and hand[2] == 'S':
- rank1 = value_order.index(hand[0])
- rank2 = value_order.index(hand[1])
- return rank2 - rank1 == 1
- return False
- while True:
- if position not in ["LJ", "HJ"] and (is_pocket_pair(hole_cards) or is_suited_connector(hole_cards)):
- if not available_actions or (available_actions == ["See Flop", "Fold"]):
- raise_call = input("Was there a raise and at least one call before you? (y/n): ").lower()
- if is_pocket_pair(hole_cards):
- if raise_call == 'y':
- print("Special rule: You can call with any pocket pair.")
- input("Press any key to continue...")
- else:
- print("Special rule: Fold pocket pair.")
- elif is_suited_connector(hole_cards):
- if position in ["CO", "BU"]:
- if raise_call:
- print("Special rule: You can call with suited connectors.")
- input("Press any key to continue...")
- else:
- print("Special rule: Fold suited connector.")
- available_actions.append("See Flop")
- print(f"Possible actions for {hole_cards} in {position}:")
- for i, action in enumerate(available_actions, 1):
- print(f"{i}. {action}")
- print("0. Fold")
- try:
- choice = int(input("Choose your action by number: "))
- if choice == 0:
- print("You chose to Fold.")
- break
- elif 1 <= choice <= len(available_actions):
- chosen_action = available_actions[choice - 1]
- print(f"You chose to {chosen_action}.")
- chosen_actions.append(chosen_action)
- if chosen_action == "Open Raise":
- if position in ["LJ", "SB"]:
- print("Open Raise to 3bb.")
- else:
- print("Open Raise to 2.5bb.")
- elif chosen_action == "IsoRaise":
- ip_oop = input("Are you in position (IP) or out of position (OOP)? ").upper()
- num_limpers = int(input("Enter the number of limpers: "))
- if ip_oop == "IP":
- bet_size = 3 + num_limpers
- print(f"IsoRaise to {bet_size}bb.")
- elif ip_oop == "OOP":
- bet_size = 4 + num_limpers
- print(f"IsoRaise to {bet_size}bb.")
- else:
- print("Invalid input for position. Please enter IP or OOP.")
- elif chosen_action in ["3bet vs Non Steal", "3bet vs Steal"]:
- ip_oop = input("Are you in position (IP) or out of position (OOP)? ").upper()
- num_calls = int(input("Enter the number of callers: "))
- betted_amount = float(input("Enter the amount betted (in bb): "))
- if ip_oop == "IP":
- if input("Are you facing a minraise? (y/n): ").lower() == 'y':
- raise_size = 4 * betted_amount + num_calls * betted_amount
- else:
- raise_size = 3 * betted_amount + num_calls * betted_amount
- print(f"3bet to {raise_size}bb.")
- elif ip_oop == "OOP":
- raise_size = 4 * betted_amount + num_calls * betted_amount
- print(f"3bet to {raise_size}bb.")
- else:
- print("Invalid input for position. Please enter IP or OOP.")
- elif chosen_action == "4Bet Bluff OOP":
- num_calls = int(input("Enter the number of callers: "))
- betted_amount = float(input("Enter the amount betted (in bb): "))
- raise_size = (3 + num_calls) * betted_amount
- print(f"4Bet to {raise_size}bb.")
- elif chosen_action == "4bet":
- num_calls = int(input("Enter the number of callers: "))
- betted_amount = float(input("Enter the amount betted (in bb): "))
- if input("Are you facing a minraise? (y/n): ").lower() == 'y':
- raise_size = (3 + num_calls) * betted_amount
- else:
- raise_size = (2.5 + num_calls) * betted_amount
- print(f"4Bet to {raise_size}bb.")
- elif chosen_action == "All-In":
- print("You chose to go All-In.")
- break
- elif chosen_action == "See Flop":
- print("You chose to see the flop.")
- break
- # Remove the chosen action and related actions from available actions
- related_actions = get_related_actions(chosen_action)
- available_actions = [action for action in available_actions if action not in related_actions and action != "See Flop" and action not in chosen_actions]
- else:
- print("Invalid choice. Please choose a valid number.")
- except ValueError:
- print("Invalid input. Please enter a number.")
- input("Press any key to continue...")
- def get_possible_actions(hole_cards, position, is_facing_lj_open):
- actions = []
- if is_facing_lj_open and position != "BB":
- # Override the 3bet ranges with HJ ranges and exclude Open Raise and IsoRaise
- special_ranges = {
- "3bet vs Non Steal": ranges["3bet"]["HJ"],
- "3bet vs Steal": ranges["3bet"]["HJ"],
- "3bet": ranges["3bet"]["HJ"],
- }
- else:
- special_ranges = None
- for action, positions in ranges.items():
- if is_facing_lj_open and action in ["Open Raise", "IsoRaise"]:
- continue # Skip Open Raise and IsoRaise actions when facing LJ open
- if special_ranges and action in special_ranges:
- if hand_in_range(hole_cards, special_ranges[action]):
- actions.append(action)
- else:
- if position in positions:
- if hand_in_range(hole_cards, positions[position]):
- actions.append(action)
- return actions
- def get_poker_options():
- while True:
- clear_screen()
- hole_cards = input("Enter your hole cards (e.g., AQo) or 'exit' to quit: ").upper()
- if hole_cards == 'EXIT':
- break
- position = input("Enter your position (LJ, HJ, CO, BU, SB, BB): ").upper()
- if position == 'EXIT':
- break
- handle_chosen_action(hole_cards, position)
- # Run the function
- get_poker_options()
Advertisement
Add Comment
Please, Sign In to add comment