예제 #1
0
    def test_game_is_created_with_correct_players(self):
        io = InputOutput(StringIO(), StringIO())
        game_loop = GameLoop(io)
        game_loop.create_game(self.player1, self.player2)

        self.assertEqual(self.player1, game_loop.game.player1)
        self.assertEqual(self.player2, game_loop.game.player2)
예제 #2
0
    def test_game_is_created_with_correct_players(self):
        io = InputOutput(StringIO(), StringIO())
        game_loop = GameLoop(io)
        game_loop.create_game(self.player1, self.player2)

        self.assertEqual(self.player1, game_loop.game.player1)
        self.assertEqual(self.player2, game_loop.game.player2)
예제 #3
0
 def test_evaluting_no_response_to_play_again_prompt(self):
     io = InputOutput(StringIO("c\nc\nno\n"), StringIO())
     game_loop = GameLoop(io)
     game_loop.create_game(self.player1, self.player2)
     self.assertFalse(game_loop.play_again())
예제 #4
0
    def test_game_is_created_with_proper_player_types(self):
        io = InputOutput(StringIO("human\ncomputer"), StringIO())
        game_loop = GameLoop(io)

        self.assertTrue(isinstance(game_loop.game.player1, Human))
        self.assertTrue(isinstance(game_loop.game.player2, Computer))
예제 #5
0
파일: play.py 프로젝트: kellyaj/pytactoe
import sys
from pytactoe.io import InputOutput
from pytactoe.game_loop import GameLoop

io = InputOutput(sys.stdin, sys.stdout)
loop = GameLoop(io)
loop.start_game()
예제 #6
0
 def test_evaluting_no_response_to_play_again_prompt(self):
     io = InputOutput(StringIO("c\nc\nno\n"), StringIO())
     game_loop = GameLoop(io)
     game_loop.create_game(self.player1, self.player2)
     self.assertFalse(game_loop.play_again())