Esempio n. 1
0
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
Esempio n. 2
0
 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
Esempio n. 3
0
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)
Esempio n. 4
0
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)
Esempio n. 5
0
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)
Esempio n. 6
0
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)
Esempio n. 7
0
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)
Esempio n. 8
0
def test_game_with_default_amount_of_players_succeeds():
    play.play_game(mmRules, 3)
Esempio n. 9
0
def test_game_with_one_player_crashes_early():
    with pytest.raises(AssertionError):
        play.play_game(mmRules, 1)
Esempio n. 10
0
 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)
Esempio n. 11
0
 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)