Activities/Turtle Art/Patching: Difference between revisions

Line 21: Line 21:
  from math import sqrt
  from math import sqrt
and
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.  
    ('sqrt','sqrt','sqrt',100),
('sqrt','sqrt','sqrt',100),
and
and
  '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) and French version (images/fr).
* 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) and French version (images/fr).
[[Image:Sqrt.gif|thumb|left|sqrt.gif]]
[[Image:Sqrt.gif|thumb|left|sqrt.gif]]