Line 16: |
Line 16: |
| * I looked at the Turtle Art program installed in Activity/TurtleArt.activity and determined where I needed to make changes. I had to add a new primitive for square root to the talogo.py file (and also include the sqrt function from the Python math module. | | * I looked at the Turtle Art program installed in Activity/TurtleArt.activity and determined where I needed to make changes. I had to add a new primitive for square root to the talogo.py file (and also include the sqrt function from the Python math module. |
| from math import sqrt | | from math import sqrt |
| + | and |
| defprim(lc,'sqrt', 1, lambda lc,x: int(sqrt(x))) | | defprim(lc,'sqrt', 1, lambda lc,x: int(sqrt(x))) |
| * And I had to define a new brick for square root in tasetup.py and describe the bricks attributes: its size; how it connects to other bricks; and default values. | | * And I had to define a new brick for square root in tasetup.py and describe the bricks attributes: its size; how it connects to other bricks; and default values. |
Line 22: |
Line 23: |
| 'sqrt': (('num',True,0,20),('num',False,42,20)), | | 'sqrt': (('num',True,0,20),('num',False,42,20)), |
| * Finally, I had to create a graphic for the brick (images/en/numbers/sqrt.gif) and modify the panel for numbers (images/en/numbers/numbersgroup,gif and numbersmask.gif). I made similar changes to the Spanish version (images/es). | | * Finally, I had to create a graphic for the brick (images/en/numbers/sqrt.gif) and modify the panel for numbers (images/en/numbers/numbersgroup,gif and numbersmask.gif). I made similar changes to the Spanish version (images/es). |
− | * I ran the modified Turtle Art program and made changes until I managed to get it working properly--i.e., I debugged my code. At one point, I sent email to the maintainer with a question, which he promptly answered. | + | * I ran the modified Turtle Art program and made changes until I managed to get it working properly—i.e., I debugged my code. At one point, I sent email to the maintainer with a question, which he promptly answered. |
| * In order to push my changes upstream so that others can use them, first I needed to get a local copy of the source code | | * In order to push my changes upstream so that others can use them, first I needed to get a local copy of the source code |
| git-clone git://dev.laptop.org/projects/turtleart-activity | | git-clone git://dev.laptop.org/projects/turtleart-activity |