-
Michael Mutote authored
Create A* search algorithm and added to search algorithms. Heuristics file with maze heuristics. Moved puzzle goal to the top Created test case for mazes
Michael Mutote authoredCreate A* search algorithm and added to search algorithms. Heuristics file with maze heuristics. Moved puzzle goal to the top Created test case for mazes
is_goal.py 461 B
MAZE_GOAL = (0, 4)
PUZZLE_GOAL = (
(0, 1, 2),
(3, 4, 5),
(6, 7, 8)
)
def is_goal_maze(state):
return MAZE_GOAL == state
def is_goal_sudoku(state):
y, x = 10, 10
for i, s in enumerate(state):
if 0 in s:
(y, x) = (i, s.index(0))
break
return (y, x) == (10, 10)
def is_goal_queens(state):
return sum(map(sum, state)) == len(state)
def is_goal_puzzle(state):
return PUZZLE_GOAL == state