Function findPath

  • Given a list of points, find a sequence of turns and moves that visits the points in order, ending with the turtle facing its original heading.

    Parameters

    • points: Point[]

      array of N input points. Adjacent points must be distinct, and the array must not start with (0,0).

    Returns number[]

    an array of length 2N+1 of the form [turn_0, move_0, ..., turn_N-1, move_N-1, turn_N] such that if the turtle starts at (0,0) heading up (positive y direction), and executes turn(turn_i) and forward(move_i) actions in the same order, then it will be at points[i] after move_i for all valid i, and be back to its original upward heading after turn_N.

Generated using TypeDoc