Get turtle's position

pos

Returns current position of a turtle as an array: {x y}.

Example:

pu
setxy 100 0
pd

repeat 10 [
  setpos array
    100 * cos 40 * (repcount-1)
    100 * sin 40 * (repcount-1)
  print pos
]

Output:
(also a drawing)

{100 0}
{76.6044443118978 64.2787609686539}
{17.364817766693 98.4807753012208}
{-50 86.6025403784439}
{-93.9692620785908 34.2020143325669}
{-93.9692620785908 -34.2020143325669}
{-50 -86.6025403784438}
{17.364817766693 -98.4807753012208}
{76.6044443118978 -64.278760968654}
{100 -2.8421709430404E-14}

See also:

Table of Content