samples/13_path_finding_algorithms/07_heuristic_with_walls/app/main.rb
def process_input_bfs_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 bfs_mouse_over_grid?
      if grid.walls.has_key?(bfs_cell_closest_to_mouse)
        grid.walls.delete(bfs_cell_closest_to_mouse)
        recalculate_searches
      end
    end
  end
# Removes walls in the first grid that are under the cursor
Removes walls in the first grid that are under the cursor
Removes walls in the first grid that are under the cursor
def process_input_bfs_remove_wall
    if bfs_mouse_over_grid?
      if grid.walls.has_key?(bfs_cell_closest_to_mouse)
        grid.walls.delete(bfs_cell_closest_to_mouse)
        recalculate_searches
      end
    end
  end
def process_input_bfs_remove_wall if bfs_mouse_over_grid? if grid . walls . has_key? ( bfs_cell_closest_to_mouse ) grid . walls . delete ( bfs_cell_closest_to_mouse ) recalculate_searches end end end
Removes walls in the first grid that are under the cursor
Removes walls in the first 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