Exemple #1
0
def get_hint(board_state, hints):
    """" Calculates the best possible move given the current state of the board
    :param hints: an instance of a Hint
    """

    graph = Graph(lambda node: node.is_goal, lambda node: zhed_board.ZhedBoard.get_all_operators(node.state))
    moves = puzzle_reader.get_boards_list(graph.a_star(board_state))
    if moves is None or len(moves) > 1:
        hints.path.extend(moves[1].move.placed_blocks)
        hints.block = moves[1].move.starting_block
        hints.hint = Hint.HINT
    else:
        pygame.event.post(pygame.event.Event(pygame.KEYDOWN, key=pygame.K_r))