Skip to content
Snippets Groups Projects
Heuristics.py 579 B
Newer Older
Michael Mutote's avatar
Michael Mutote committed
import is_goal
Michael Mutote's avatar
Michael Mutote committed
import Sucessors
Michael Mutote's avatar
Michael Mutote committed






def maze_opt(path):
    """maze search heuristic going to have to use the euclidian distance, so it works for any maze"""
    state = path[-1]
    return (is_goal.MAZE_GOAL[0] - state[0])**2 + (is_goal.MAZE_GOAL[1] - state[1])**2


Michael Mutote's avatar
Michael Mutote committed
def puzzle_opt(path):
Michael Mutote's avatar
Michael Mutote committed
    pass


Michael Mutote's avatar
Michael Mutote committed
def sudoku_opt(path):
Michael Mutote's avatar
Michael Mutote committed
    starting_point = [Sucessors.choose_best_subsquare(path[-1]), Sucessors.choose_best_rows(path[-1]),
                      Sucessors.choose_best_column(path[-1])]
    return max(starting_point, key=lambda w: w[2])[-1]
Michael Mutote's avatar
Michael Mutote committed


Michael Mutote's avatar
Michael Mutote committed
def queens_opt(path):
Michael Mutote's avatar
Michael Mutote committed
    pass