samples/13_path_finding_algorithms/01_breadth_first_search/app/main.rb
def recalculate
    # Resets the search
    state.frontier = []
    state.visited = {}

    # Moves the animation forward one step at a time
    state.anim_steps.times { calc }
  end
# Whenever the user edits the grid,
# The search has to be recalculated upto the current step
# with the current grid as the initial state of the grid
Whenever the user edits the grid,
The search has to be recalculated upto the current step
with the current grid as the initial state of the grid
Whenever the user edits the grid The search has to be recalculated upto the current step with the current grid as the initial state of the grid
def recalculate
    state.frontier = []
    state.visited = {}
    state.anim_steps.times { calc }
  end
def recalculate state . frontier = [ ] state . visited = { } state . anim_steps . times { calc } end
Whenever the user edits the grid,
The search has to be recalculated upto the current step
with the current grid as the initial state of the grid
Whenever the user edits the grid The search has to be recalculated upto the current step with the current grid as the initial state of the grid
# Resets the search # Moves the animation forward one step at a time