samples/13_path_finding_algorithms/08_a_star/app/main.rb
def process_input_greedy_remove_wall
    # The mouse needs to be inside the grid, because we only want to remove walls
    # the cursor is directly over
    # Recalculations should only occur when a wall is actually deleted
    if greedy_mouse_over_grid?
      if grid.walls.has_key?(greedy_cell_closest_to_mouse)
        grid.walls.delete(greedy_cell_closest_to_mouse)
        reset_searches
      end
    end
  end
# Removes walls in the second grid that are under the cursor
Removes walls in the second grid that are under the cursor
Removes walls in the second grid that are under the cursor
def process_input_greedy_remove_wall
    if greedy_mouse_over_grid?
      if grid.walls.has_key?(greedy_cell_closest_to_mouse)
        grid.walls.delete(greedy_cell_closest_to_mouse)
        reset_searches
      end
    end
  end
def process_input_greedy_remove_wall if greedy_mouse_over_grid? if grid . walls . has_key? ( greedy_cell_closest_to_mouse ) grid . walls . delete ( greedy_cell_closest_to_mouse ) reset_searches end end end
Removes walls in the second grid that are under the cursor
Removes walls in the second grid that are under the cursor
# The mouse needs to be inside the grid, because we only want to remove walls # the cursor is directly over # Recalculations should only occur when a wall is actually deleted