def solve_it(startstate, endstate, actions)
   state = startstate
   steps = []
   while state != endstate
      beststep = nil
      bestdistance = nil
      actions.each { |step|
        distance = step.action(state).distance(endstate)
        beststep, bestdistance = distance if !bestdistance || distance < bestdistance
      }
      steps.push beststep
   end
   steps
end
