pot = 0.0 player_turn = training_round % 2 # Player 1 starts if 0, otherwise player 2 starts # Go through betting visited_action_states_1 = [] visited_action_states_2 = [] intermediate_payoffs_1 = [] intermediate_payoffs_2 = [] player_1_fold_f = False # Flag for keeping track of if player 1 has folded player_2_fold_f = False # Flag for keeping track of if player 2 has folded raise_f = False # Flag for keeping track of if any subsequent "bets" are in fact raises while gs.get_possible_actions(): if player_turn == 0: cs = gs.get_current_ai_state_id() action = p1.draw_action(cs) gs.append_action(action) visited_action_states_1.append( (cs[0], cs[1], cs[2], cs[3], action)) if action == 'B' and raise_f: pot += 2.0 intermediate_payoffs_1.append(-2.0) elif action == 'B' and not raise_f: pot += 1.0 intermediate_payoffs_1.append(-1.0) raise_f = True elif action == 'C': pot += 1.0 intermediate_payoffs_1.append(-1.0) elif action == 'F': player_1_fold_f = True intermediate_payoffs_1.append(0.0)
# Used to test stuff from Poker_Bot import Game_State from deuces import Card from deuces import Deck import numpy as np gs = Game_State() deck = Deck() gs.set_player_cards(deck.draw(2)) gs.set_opponent_cards(deck.draw(2)) gs.set_flop(deck.draw(3)) gs.append_action('B') gs.append_action('B') gs.print_player_cards() gs.print_opponent_cards() gs.print_player_hand() gs.print_opponent_hand() print(gs.is_winner()) print gs.get_current_state_id() # Used to test Policy class from Poker_Bot import Policy p = Policy.create_uniform() opt_state_action = (1, 2, 4, ('Ch', 'B'), 'B') p.update(opt_state_action) # Used to test State_Action_Value_Function class