def test_board_can_get_valid_neighboring_locations(self): valid_locations = Board.get_valid_neighboring_locations((1, 1)) self.assertIn((0,1), valid_locations) self.assertEqual(len(valid_locations), 8) valid_locations = Board.get_valid_neighboring_locations((0, 1)) self.assertIn((0,0), valid_locations) self.assertEqual(len(valid_locations), 5)
def test_gets_multiple_solutions(self): initial_layout = 'c a p e ' * 4 initial_layout = initial_layout.strip() board = Board.build_board_from_string( initial_layout ) solutions = self._solve_board(board) self.assertGreater(len(solutions), 1) self.assertIn('cape', solutions) self.assertIn('ape', solutions) self.assertNotIn('pea', solutions)
def test_board_can_be_built_from_space_separated_strings(self): bunch_of_as = 'a ' * 16 bunch_of_as = bunch_of_as.strip() board = Board.build_board_from_string(bunch_of_as)