samples/13_path_finding_algorithms/08_a_star/app/main.rb
# Moves the star to the cell closest to the mouse in the third grid
# Only resets the search if the star changes position
# Called whenever the user is editing the star (puts mouse down on star)
Moves the star to the cell closest to the mouse in the third grid
Only resets the search if the star changes position
Called whenever the user is editing the star (puts mouse down on star)
Moves the star to the cell closest to the mouse in the third grid Only resets the search if the star changes position Called whenever the user is editing the star ( puts mouse down on star )
def process_input_a_star_star
    old_star = grid.star.clone
    unless a_star_cell_closest_to_mouse == grid.target
      grid.star = a_star_cell_closest_to_mouse
    end
    unless old_star == grid.star
      reset_searches
    end
  end
def process_input_a_star_star old_star = grid . star . clone unless a_star_cell_closest_to_mouse == grid . target grid . star = a_star_cell_closest_to_mouse end unless old_star == grid . star reset_searches end end
Moves the star to the cell closest to the mouse in the third grid
Only resets the search if the star changes position
Called whenever the user is editing the star (puts mouse down on star)
Moves the star to the cell closest to the mouse in the third grid Only resets the search if the star changes position Called whenever the user is editing the star ( puts mouse down on star )