packages feed

swarm-0.5.0.0: data/scenarios/Testing/836-pathfinding/_836-path-exists/find-entity-unwalkable-solution.sw

def goDir = \goalItem. \f. \d.
  if (d == down) {
    grab; return ()
  } {
    turn d;
    itemAhead <- scan forward;
    let isGoalAhead = case itemAhead (\_. false) (\item. item == goalItem) in
    if isGoalAhead {
      return ();
    } {
      move; f;
    };
  }
  end;

def followRoute =
    let goalItem = "water" in
    nextDir <- path (inL ()) (inR goalItem);
    case nextDir return $ goDir goalItem followRoute;
    end;

followRoute;