samples/13_path_finding_algorithms/05_dijkstra/app/main.rb
# Determines what the user is editing and stores the value
# This method is called the tick the mouse is clicked
# Storing the value allows the user to continue the same edit as long as the
# mouse left click is held
Determines what the user is editing and stores the value
This method is called the tick the mouse is clicked
Storing the value allows the user to continue the same edit as long as the
mouse left click is held
Determines what the user is editing and stores the value This method is called the tick the mouse is clicked Storing the value allows the user to continue the same edit as long as the mouse left click is held
def determine_input
    if mouse_over_star?
      state.user_input = :star
    elsif mouse_over_star2?
      state.user_input = :star2
    elsif mouse_over_target?
      state.user_input = :target
    elsif mouse_over_target2?
      state.user_input = :target2
    elsif mouse_over_wall?
      state.user_input = :remove_wall
    elsif mouse_over_wall2?
      state.user_input = :remove_wall2
    elsif mouse_over_hill?
      state.user_input = :add_wall
    elsif mouse_over_hill2?
      state.user_input = :add_wall2
    elsif mouse_over_grid?
      state.user_input = :add_hill
    elsif mouse_over_grid2?
      state.user_input = :add_hill2
    end
  end
def determine_input if mouse_over_star? state . user_input = :star elsif mouse_over_star2? state . user_input = :star2 elsif mouse_over_target? state . user_input = :target elsif mouse_over_target2? state . user_input = :target2 elsif mouse_over_wall? state . user_input = :remove_wall elsif mouse_over_wall2? state . user_input = :remove_wall2 elsif mouse_over_hill? state . user_input = :add_wall elsif mouse_over_hill2? state . user_input = :add_wall2 elsif mouse_over_grid? state . user_input = :add_hill elsif mouse_over_grid2? state . user_input = :add_hill2 end end
Determines what the user is editing and stores the value
This method is called the tick the mouse is clicked
Storing the value allows the user to continue the same edit as long as the
mouse left click is held
Determines what the user is editing and stores the value This method is called the tick the mouse is clicked Storing the value allows the user to continue the same edit as long as the mouse left click is held
# 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 a hill in the first grid # The user is adding a wall from the first grid # If the mouse is over a hill in the second grid # The user is adding a wall from the second grid # If the mouse is over the first grid # The user is adding a hill from the first grid # If the mouse is over the second grid # The user is adding a hill from the second grid