[docs] [issue10170] Relationship between turtle speed setting and actual speed is not documented

Alexander Belopolsky report at bugs.python.org
Thu Oct 21 22:20:11 CEST 2010


New submission from Alexander Belopolsky <belopolsky at users.sourceforge.net>:

As Terry J. Reedy mentioned in his comment on issue 7061, turtle documentation is lacking information on how speed "codes" 0-10 translate into actual turtle speed.

Attached script measures the speed of the two primitive operations that form the basis of turtle functionality at various speed settings.  The results below show highly irregular pattern.  The columns are: the speed code, time to draw a 200 unit line, time to complete a 360 degrees turn and the ratio of the two times.


         0: 0.01 0.01 0.83
         1: 1.04 2.05 0.51
         2: 0.49 1.06 0.46
         3: 0.30 0.72 0.42
         4: 0.23 0.54 0.44
         5: 0.17 0.44 0.38
         6: 0.13 0.39 0.35
         7: 0.08 0.32 0.26
         8: 0.08 0.28 0.30
         9: 0.10 0.27 0.37
        10: 0.08 0.23 0.36


>From the source code, it appears that the on-screen speed is controlled by the number of animation steps while each step takes approximately time controlled by the "delay" setting that defaults to 10 milliseconds.

The number of steps is determined by somewhat peculiar computations.  For a rotation by angle of a degrees at speed setting s, the number of steps is

       n = 2 + int(a / (3 * s))

and for drawing a line of length d,

       n = 1 +  int(d / (3 * 1.1**s * s))

I am not sure what was the reason for these choices, but I think it would be better if numeric speed code had a more direct relationship to the apparent speed.

----------
assignee: docs at python
components: Demos and Tools, Documentation
messages: 119334
nosy: belopolsky, docs at python, eric.araujo, georg.brandl, gregorlingl, terry.reedy
priority: normal
severity: normal
status: open
title: Relationship between turtle speed setting and actual speed is not documented
versions: Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10170>
_______________________________________


More information about the docs mailing list