code-dot-org/code-dot-org — pull request #266 by cpirich (2014-10-28 16:28:42+00:00)
Title: turtle supports editcode

![screen shot 2014-10-28 at 9 27 13 am](https://cloud.githubusercontent.com/assets/5429146/4812256/57de7a0a-5ebf-11e4-84fe-2ac5b8cd1401.png)
1. Added support for editCode levels to turtle/artist.
* refactored code from webapp to codegen.js to it can be shared by other apps
* modified Turtle.evalCode to function differently when level.editCode is true (grab code from editor, always succeed if drawing matches)
* changed Turtle.animate to use new helper functions: executeTuple() and doneExecuting()
* changed Turtle.animate to behave very differently in editCode mode. Instead of running the entire program and building up the command queue in api.log, each animate timer event now steps the interpreter continuously until a command tuple is present in the api.log. For the first time, we are actually executing the program while it is animating, which allows us to highlight the javascript that is executing while it is actually running (synchronized with the drawing). This will eventually allow stepping, breakpoints, etc. Note that you have to click the secret button (instructions icon) to see the javascript code instead of the droplet blocks.
2. Added 4 editcode levels to turtle, cloning 1_1 through 1_4 (as ec_1_1 through ec_1_4).
3. Added ArtistEC game in the dashboard (clone of Artist) with support to load editcode scripts (as with MazeEC and Webapp).
4. Added one new level (turtle_ec_1_2) to the editcode script.
5. Added dashboard text for the new game, stage, and instruction text for the most recent two levels in the editcode script.