def test_final_round(): flow = { 'prints': [ 'Welcome to the Game of Greed!', 'Game over! Your final score is 100', ], 'prompts': [ 'Wanna play? Type y to roll ', 'Would you like to keep 1? y for yes : n for no ', 'Would you like to keep 2? y for yes : n for no ', 'Would you like to keep 2? y for yes : n for no ', 'Would you like to keep 3? y for yes : n for no ', 'Would you like to keep 3? y for yes : n for no ', 'Would you like to keep 4? y for yes : n for no ', ], 'responses': [ 'y', 'y', 'y', 'y', 'y', 'y', 'y' ], 'rolls': [ [1, 2, 2, 3, 3, 4], ] } mp = MockPlayer(**flow) game = Game(mp.mock_print, mp.mock_input, 9) game.roll_dice = mp.mock_roll game.play_game() assert mp.mop_up()
from game_of_greed import Game class Player: def __init__(self): pass def _print(self, *args): print('bot') print(args) def _input(self, *args): print('bot') return input(args) if __name__ == "__main__": bot = Player() game = Game(bot._print, bot._input) game.play_game()