Esempio n. 1
0
 def test_game_over_if_winner_found(self):
     ticTacToeSetup = TicTacToeSetup()
     is_game_over = ticTacToeSetup.game_over(ticTacToeSetup.board)
     self.assertEqual(is_game_over, False)
     ticTacToeSetup.board = [[0, 0, 0], [-1, -1, -1], [1, -1, 1]]
     ticTacToeSetup.award_score(ticTacToeSetup.board)
     is_game_over = ticTacToeSetup.game_over(ticTacToeSetup.board)
     self.assertEqual(is_game_over, True)
Esempio n. 2
0
 def test_score_should_be_negative_one_if_human_has_won(self):
     ticTacToeSetup = TicTacToeSetup()
     ticTacToeSetup.board = [[0, 0, 0], [-1, -1, -1], [1, -1, 1]]
     score = ticTacToeSetup.award_score(ticTacToeSetup.board)
     self.assertEqual(score, -1)
Esempio n. 3
0
 def test_score_should_be_zero_if_the_game_is_a_tie(self):
     ticTacToeSetup = TicTacToeSetup()
     ticTacToeSetup.board = [[0, 0, 0], [-1, 0, -1], [1, -1, 1]]
     score = ticTacToeSetup.award_score(ticTacToeSetup.board)
     self.assertEqual(score, 0)
Esempio n. 4
0
 def test_score_should_be_one_if_computer_has_won(self):
     ticTacToeSetup = TicTacToeSetup()
     ticTacToeSetup.board = [[0, 0, 0], [1, 1, 1], [1, -1, 1]]
     score = ticTacToeSetup.award_score(ticTacToeSetup.board)
     self.assertEqual(score, 1)