samples/13_path_finding_algorithms/07_heuristic_with_walls/app/main.rb
# Determines what the user is editing
# This method is called when the mouse is clicked down
Determines what the user is editing
This method is called when the mouse is clicked down
Determines what the user is editing This method is called when the mouse is clicked down
def determine_input
    if mouse_over_slider?
      state.user_input = :slider
    elsif bfs_mouse_over_star?
      state.user_input = :bfs_star
    elsif heuristic_mouse_over_star?
      state.user_input = :heuristic_star
    elsif bfs_mouse_over_target?
      state.user_input = :bfs_target
    elsif heuristic_mouse_over_target?
      state.user_input = :heuristic_target
    elsif bfs_mouse_over_wall?
      state.user_input = :bfs_remove_wall
    elsif heuristic_mouse_over_wall?
      state.user_input = :heuristic_remove_wall
    elsif bfs_mouse_over_grid?
      state.user_input = :bfs_add_wall
    elsif heuristic_mouse_over_grid?
      state.user_input = :heuristic_add_wall
    end
  end
def determine_input if mouse_over_slider? state . user_input = :slider elsif bfs_mouse_over_star? state . user_input = :bfs_star elsif heuristic_mouse_over_star? state . user_input = :heuristic_star elsif bfs_mouse_over_target? state . user_input = :bfs_target elsif heuristic_mouse_over_target? state . user_input = :heuristic_target elsif bfs_mouse_over_wall? state . user_input = :bfs_remove_wall elsif heuristic_mouse_over_wall? state . user_input = :heuristic_remove_wall elsif bfs_mouse_over_grid? state . user_input = :bfs_add_wall elsif heuristic_mouse_over_grid? state . user_input = :heuristic_add_wall end end
Determines what the user is editing
This method is called when the mouse is clicked down
Determines what the user is editing This method is called when the mouse is clicked down
# If the mouse is over the star in the first grid # The user is editing the star from the first grid # If the mouse is over the star in the second grid # The user is editing the star from the second grid # If the mouse is over the target in the first grid # The user is editing the target from the first grid # If the mouse is over the target in the second grid # The user is editing the target from the second grid # If the mouse is over a wall in the first grid # The user is removing a wall from the first grid # If the mouse is over a wall in the second grid # The user is removing a wall from the second grid # If the mouse is over the first grid # The user is adding a wall from the first grid # If the mouse is over the second grid # The user is adding a wall from the second grid