def play(): global game global deck # this object will store all relevant information about the game deck = new_round() deal_hole_cards() # This while is just to keep the game going until there's only 1 player left, as proper betting is not implemented yet #while not game.getFinished(): print "GAME START!" print_players() print_table() remaining = game.getRemaining() #print len(remaining) if len(remaining) < 2: game.setFinished(True) player_won(remaining[0]) small_blind = remaining[0] big_blind = remaining[1] print "Player", small_blind.no, "is small blind, and player", big_blind.no, "is big blind" betting.small_blind(small_blind, game.getTable()) betting.big_blind(big_blind, game.getTable()) print "Betting before flop \n------------------------------" game.setState("preFlop") clearNumRaises() game.state = 1 pre_flop() flop() print_table() print "Betting before turn \n------------------------------" game.setState("postFlop") clearNumRaises() game.state = 2 bet() small_blind.blind = False big_blind.blind = False turn() print_table() print "Betting before river \n------------------------------" game.setState("postTurn") clearNumRaises() game.state = 3 bet() river() print_table() print "Betting after river \n------------------------------" game.setState("postTurn") clearNumRaises() game.state = 4 bet() remaining = game.getRemaining() if len(remaining) > 1: handle_contexts(game) showdown() elif not game.finished: player_won(remaining[0]) random.shuffle(game.getPlayers())
def play(): game_finished = False new_round() deal_hole_cards() global table table = Table() # this object will store all relevant information about the game # still to be implemented game = Game_State(table, players, False) global deck # This while is just to keep the game going until there's only 1 player left, as proper betting is not implemented yet while not game.finished: remaining = find_remaining(players) print len(remaining) if len(remaining) < 2: game.finished = True player_won(remaining[0]) break small_blind = remaining[0] big_blind = remaining[1] betting.small_blind(small_blind, table) betting.big_blind(big_blind, table) pre_flop(game) flop() bet(game) small_blind.blind = False big_blind.blind = False turn() bet(game) river() bet(game) if len(remaining) > 1: showdown(game) random.shuffle(players) table.clear_table() deck = cards.card_deck()