Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The turtle doesn't seem to be able to round... #9

Open
choldgraf opened this issue Aug 5, 2017 · 4 comments · May be fixed by #23
Open

The turtle doesn't seem to be able to round... #9

choldgraf opened this issue Aug 5, 2017 · 4 comments · May be fixed by #23

Comments

@choldgraf
Copy link
Collaborator

If you give it a left or right command that has lots of decimals, then the turtle performs this action, but hangs and will not respond to commands afterwards.

In my case, I can recreate this by:

won't work

t.right(40.435435)
t.forward(60)

will work

t.right(np.round(40.435435))
t.forward(60)
@takluyver
Copy link
Owner

I think it's this line that decides when it has reached one point, so that it can go onto the next. You're probably running into floating point issues. Maybe it needs to check with a tolerance.

@t3rodrig
Copy link

t3rodrig commented Jun 1, 2018

I have the same problem:

bob = Turtle()
n = 7
ang = round(360/n, 1)
ds = 50
for i in range(2):
    bob.forward(ds)
    bob.left(ang)

does not work properly. The angle has just 1 decimal number, but the turtle does not draw the second line.

@takluyver
Copy link
Owner

I think the turtle's angle changes in steps, and it overshoots the correct angle and then gets stuck turning one degree left and one degree right. Here's the code for that:

https://github.com/takluyver/mobilechelonian/blob/0.5/mobilechelonian/mobilechelonianjs/turtlewidget.js#L232-L248

Pull requests welcome :-)

@ghost
Copy link

ghost commented Nov 28, 2018

I would like to speed up drawing circle
I use speed(10) method but not work.
As I know, drawing circle is using n-side line to finish this job
speed method only can help line section.
why?

@flsmith flsmith linked a pull request Aug 19, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants