def _simulate_games(players, reps): log.info("players: %s; %s reps", players, reps) mmRules = rules.MauMau() games = [] for i in range(reps): game = play.play_game(mmRules, players) games.append(game) return games
def _simulate_games(self, players, reps): log.info("players: %s; %s reps", players, reps) mmRules = rules.MauMau() games = [] for i in range(reps): game = play.play_game(mmRules, players) games.append(game) return games
def play_interactive_game(): log.setLevel(level=logging.DEBUG) playedGame = play.play_game(_rulesOfTheGame, ['Eric', 'John', 'human']) log.info("And the winner is %s", playedGame.table.winner.name)
def play_simple_game(players=3): log.setLevel(level=logging.DEBUG) playedGame = play.play_game(_rulesOfTheGame, players) log.info("And the winner is %s", playedGame.table.winner.name)
def test_game_with_too_many_players_crashes_early(): deckSize = len([(v, s) for v in DECK.VALUES for s in DECK.SUITS]) tooManyPlayers = deckSize // mmRules.cardsPerPlayer + 2 with pytest.raises(AssertionError): play.play_game(mmRules, tooManyPlayers)
def test_game_with_default_amount_of_players_succeeds(): play.play_game(mmRules, 3)
def test_game_with_one_player_crashes_early(): with pytest.raises(AssertionError): play.play_game(mmRules, 1)
def play(self): """play a game""" log.setLevel(level=logging.DEBUG) playedGame = play.play_game(self.rules, ['Eric', 'John', 'human']) log.info("And the winner is %s", playedGame.table.winner.name)
def sim(self, players=3): """simulate a game""" log.setLevel(level=logging.DEBUG) finishedGame = play.play_game(self.rules, players) log.info("And the winner is %s", finishedGame.table.winner.name)