def show_game(num_players, win=True): g = Game() [display(g.add_player("player_%d" % i)) for i in range(1, num_players + 1)] p1 = g._players[g._players.keys()[0]].name g.start_game(p1) while not g._is_game_over(): for c in ["red", "white", "blue", "green", "yellow"]: for i in xrange(1, 6): # get current player p = g.turn_order[0] # card 'A' is always first. g._players[p].sort_cards() # the fix in in, put the in/correct card at 'A' if win: g._players[p].hand[0] = Card(c, i, "A") else: g._players[p].hand[0] = Card(c, 6 - i, "A") print "%s playing card A" % p display(g.play_card(p, "A")) if g._is_game_over(): return
def show_game(num_players, win=True): g = Game() [display(g.add_player('player_%d' % i)) for i in range(1, num_players+1)] p1 = g._players[g._players.keys()[0]].name g.start_game(p1) while not g._is_game_over(): for c in Game.colors: for i in xrange(1, 6): # get current player p = g.turn_order[0] # card 'A' is always first. g._players[p].sort_cards() # the fix in in, put the in/correct card at 'A' if win: g._players[p].hand[0] = Card(c, i, 'A') else: g._players[p].hand[0] = Card(c, 6-i, 'A') show_hands(g) print '%s playing card A' % p display(g.play_card(p, 'A')) if g._is_game_over(): return