def test_possible_actions_for_min(self): expected_num_actions = 128 game = NumericalTicTacToe() possible_actions = game.possible_actions(Min) self.assertEqual(expected_num_actions, len(possible_actions)) self.assertIn(Action((1, 2), 2), possible_actions) self.assertIn(Action((3, 3), 8), possible_actions) self.assertIn(Action((0, 1), 12), possible_actions) self.assertNotIn(Action((-1, 0), 4), possible_actions) self.assertNotIn(Action((4, 0), 8), possible_actions) self.assertNotIn(Action((3, 0), 1), possible_actions)
def test_possible_actions_for_min_with_dimension_two(self): expected_num_actions = 8 game = NumericalTicTacToe(dimension=2) possible_actions = game.possible_actions(Min) self.assertEqual(expected_num_actions, len(possible_actions)) self.assertIn(Action((0, 1), 4), possible_actions) self.assertIn(Action((1, 0), 2), possible_actions) self.assertIn(Action((1, 1), 4), possible_actions) self.assertNotIn(Action((-1, 0), 1), possible_actions) self.assertNotIn(Action((0, 0), 1), possible_actions) self.assertNotIn(Action((3, 0), 1), possible_actions)
def test_possible_actions_for_max(self): expected_num_actions = 128 game = NumericalTicTacToe() possible_actions = game.possible_actions(Max) self.assertEqual(expected_num_actions, len(possible_actions)) self.assertIn(Action((0, 0), 1), possible_actions) self.assertIn(Action((0, 3), 9), possible_actions) self.assertIn(Action((2, 2), 11), possible_actions) self.assertNotIn(Action((-1, 0), 1), possible_actions) self.assertNotIn(Action((4, 0), 1), possible_actions) self.assertNotIn(Action((3, 0), 2), possible_actions)