Activities/Turtle Art/Under the hood: Difference between revisions

Created page with "==Looking under the hood== Turtle Art projects are stored as a .ta file contains a [http://docs.python.org/library/json.html json-encoded] serialization of the project. The jso..."
 
Line 5: Line 5:
The json encoding of a repeat 4 forward 100 right 90 project:
The json encoding of a repeat 4 forward 100 right 90 project:
                                        
                                        
  [[0,"repeat",331,158,[null,1,2,null]],[1,["number","4"],417,167,[0,null]],[2,"forward",426,207,[0,3,4]],[3,["number","100"],500,216,[2,null]],[4,"right",426,246,[2,5,null]],[5,["number","90"],500,255,[4,null]],[-1,"turtle",0,0,0,0,50,5]]
  [[0,"repeat",331,158,[null,1,2,null]],
[1,["number","4"],417,167,[0,null]],
[2,"forward",426,207,[0,3,4]],
[3,["number","100"],500,216,[2,null]],
[4,"right",426,246,[2,5,null]],
[5,["number","90"],500,255,[4,null]],
[-1,"turtle",0,0,0,0,50,5]]


The basic structure of the encoding is a list of lists, where each block has these elements:
The basic structure of the encoding is a list of lists, where each block has these elements:
Line 23: Line 29:
# pen shade
# pen shade
# pen width
# pen width


== Modifying Turtle Art ==
== Modifying Turtle Art ==