none
Turtle.Angle is this a Bug or a Feature? RRS feed

  • Question

  • I was playing around with the app I posted to the forum this past Sunday and I noticed something interesting.

     

    The Turtle.Angle property is returning angles outside the range of 0-360. Some values are negative, others are greater then 360.

     

    On a hunch I wrote this little test a few minutes ago.

     

    Turtle.Speed = 10 
    For i = 1 To 1000 
      Turtle.Turn(2) 
      Turtle.Move(2) 
    EndFor 
    TextWindow.WriteLine(Turtle.Angle) 

     

    When you run the test, the resulting angle is reported as 2000. The obvious result is that the value for Angle is being set by computing the end results of all of the turn commands; adding for right turns, subtracting for left turns. At no point is the system resetting to keep the value in the range of a normal 0-360 compass heading.

     

    This poses the question: Is this a bug (the angle should stay in the range of 0-360) or is it a feature (the angle should match the sum of all the turns)?

     

    Friday, February 13, 2009 1:39 AM
    Answerer

Answers