Esempio n. 1
0
 def standard_test_case(self, expected, grid):
     cases = [{"hash":expected, "player":0}, {"hash":-expected, "player":1}]
     for case in cases:
         grid_hash = hash_grid(grid, case["player"])
         self.assertEqual(case["hash"], grid_hash)
         result, player = TicTacToe.reconstruct(grid_hash)
         self.assertEqual(grid, result)
         self.assertEqual(case["player"], player)
         game_state = TicTacToe(grid_hash)
         self.assertEqual(case["hash"], game_state.grid_hash)
         self.assertEqual(case["player"], game_state.player)
         self.assertEqual(grid, game_state.grid)
Esempio n. 2
0
 def standard_test_case(self, expected, grid):
     for player in range(2):
         grid_hash = hash_grid(grid, player)
         game_state = TicTacToe(grid_hash)
         self.assertEqual(expected, game_state.utility())
Esempio n. 3
0
 def standard_test_case(self, expected, grid, player, move):
     grid_hash = hash_grid(grid, player)
     game_state = TicTacToe(grid_hash)
     result = TicTacToe.reconstruct(game_state.result(move))
     self.assertEqual(expected, result)