Closed ghost closed 7 years ago
Weird. It looks like the code uses the same maths as forward()
, but with the signs switched. Can you see the mistake?
I agree with you : it's weird. Il have looked into the code. I have not found the bug.
Another test
t.forward(100)
t.left(90)
t.backward(50)
That should give
Bug it gives
I think there's a problem of a quarter of turn.
I can't find the problem in the code because i don't understand what self.bearing
means exactly, for example what means
self.bearing
equals 0self.bearing
equals 90self.bearing
equals -90 ?
(There is a lack of information about that).
I have seen the merge request #5 with a change between cos and sin.
There is at self.bearing = 90
at https://github.com/takluyver/mobilechelonian/blob/master/mobilechelonian/__init__.py#L38
Bearing is like compass bearing: 0 means north (or upwards), 90 is east (right), and so on. self.bearing = 90
tells it to start pointing right.
Maybe it was fixed in #5 but the fix isn't released yet.
I think #5 may well have fixed it - I've just made a 0.4 release, can you install it and have a go?
I upgraded to 0.4 release.
from mobilechelonian import Turtle
t = Turtle()
t.speed(5)
t.forward(100)
t.backward(100)
from mobilechelonian import Turtle
t = Turtle()
t.speed(5)
t.forward(100)
t.left(90)
t.backward(50)
I think the bug is fixed ! Thanks !
Hooray! Thanks to @FranciscoMoya who fixed it :-)
I think there is a bug in the code of the method backward(). The turtle goes down, instead of moving back.