def wypisz_karty(card_ints): output = '' for i in range(len(card_ints)): c = card_ints[i] if i != len(card_ints) - 1: output += str(Card.int_to_pretty_str(c)) + "," else: output += str(Card.int_to_pretty_str(c)) + " " return output
def hand_to_str(hand): output = " " for i in range(len(hand)): c = hand[i] if c == -1: if i != len(hand) - 1: output += '[ ],' else: output += '[ ] ' continue if i != len(hand) - 1: output += str(Card.int_to_pretty_str(c)) + ',' else: output += str(Card.int_to_pretty_str(c)) + ' ' return output
def _show_cards(self, hand_cards): suitrank_ints = [c & 0xFF00 for c in hand_cards] sorted_indices = sorted(range(len(suitrank_ints)), key=lambda k: suitrank_ints[k]) sorted_cards = [hand_cards[ind] for ind in sorted_indices] qq = [Card.int_to_pretty_str(c) for c in sorted_cards] print(' '.join(qq))
def build_subtree(self, target_node, path): self.count += 1 if type(target_node) == BeginNode: subpath = path + "\\Beginnode" + str(self.count) elif type(target_node) == CardNode: if target_node.board == "": subpath = path + "\\" + str([ Card.int_to_pretty_str(card) for card in target_node.hands ]) elif len(target_node.board) == 3: subpath = path + "\\" + str([ Card.int_to_pretty_str(card) for card in target_node.board ]) else: subpath = path + "\\" + Card.int_to_pretty_str( target_node.board[-1]) elif type(target_node) == ActionNode: subpath = path + "\\(" + action_to_str[ target_node.label] + "," + action_to_str[ target_node.previous_action] + ")" else: subpath = path + "\\" + target_node.reason if os.path.exists(subpath) == False: os.mkdir(subpath) os.chdir(subpath) print(self.count, type(target_node)) if type(target_node) == TerminalNode: with open("node info.txt", "w") as f: f.write(str(target_node)) else: target_node.get_children() with open("node info.txt", "w") as f: f.write(str(target_node)) if len(target_node.board) != "": Card.print_pretty_cards(target_node.board) for node in target_node.children: self.build_subtree(node, subpath)
def card_to_str(card): if card == -1: return '' return Card.int_to_pretty_str(card)
stage_initial_potsize += 100 action_player2 = input("Select Action: Fold;Check/Call;Bet") if action_player2 == "Fold": return "Player 1", stage_initial_potsize, 100, 0, action_player1, action_player2 else: return "", stage_initial_potsize + 100, 100, 100, action_player1, action_player2 model_path = Path('models') model = models.load_model("models/self_play_4.model") deck = Deck() flop = deck.draw(3) print('Flop Cards') for card in flop: print(Card.int_to_pretty_str(card)) player1_hand = deck.draw(2) print("CNN Player Cards") for card in player1_hand: print(Card.int_to_pretty_str(card)) player2_hand = deck.draw(2) print("Human Player Cards") for card in player2_hand: print(Card.int_to_pretty_str(card)) turn = deck.draw(1) print("Turn ", Card.int_to_pretty_str(turn)) river = deck.draw(1) print("River ", Card.int_to_pretty_str(river)) evaluator = Evaluator() player1_complete_hand = flop + [turn] + [river] + player1_hand player2_complete_hand = flop + [turn] + [river] + player2_hand
def showCard(self, cards): output = " " for card in (cards): output += Card.int_to_pretty_str(getCard(card)) + "," return output
def __str__(self): return Card.int_to_pretty_str(self._card)