Difference between revisions of "Activities/Turtle Art/Tutorials/Turtle Art Code for Turing Machine"

From Sugar Labs
Jump to navigation Jump to search
(Headings; images to come)
(Add Turtle Art action images)
Line 1: Line 1:
Turtle Art Code for Turtle Art Turing Machine
+
==Turtle Art Code for Turtle Art Turing Machine==
  
In progress.
+
Click thumbnails to see full-size code blocks.
  
 
* The Start action is the main procedure
 
* The Start action is the main procedure
 +
 +
[[File:Start.png|thumb|none|Start action]]
  
 
* The Setup action defines and initializes variables, and sets the orientation of the turtle
 
* The Setup action defines and initializes variables, and sets the orientation of the turtle
 +
 +
[[File:Setup.png|thumb|none|Setup action]]
  
 
* The Tape action writes the initial tape. User can change values in repeat statements to change arguments.
 
* The Tape action writes the initial tape. User can change values in repeat statements to change arguments.
 +
 +
[[File:Tape.png|thumb|none|Tape action]]
  
 
* The Program action followed by the stack1 action writes the program table line by line. This is divided in two so that the segments fit in the Turtle Art workspace
 
* The Program action followed by the stack1 action writes the program table line by line. This is divided in two so that the segments fit in the Turtle Art workspace
 +
 +
[[File:Program.png|thumb|none|Program action]]
  
 
* The Execute action carries out the next program step until the halt state is reached
 
* The Execute action carries out the next program step until the halt state is reached
 +
[[File:Execute.png|thumb|none|Execute action]]
  
 
* The ToTape action Move turtle to current cell on tape
 
* The ToTape action Move turtle to current cell on tape
 +
[[File:ToTape.png|thumb|none|ToTape action]]
  
 
* The ToProgram action Move Turtle to beginning of current program row to execute
 
* The ToProgram action Move Turtle to beginning of current program row to execute
 +
 +
[[File:ToProgram.png|thumb|none|ToProgram action]]
  
 
* The WriteCell action Write current color to current cell, and move to next cell
 
* The WriteCell action Write current color to current cell, and move to next cell
 +
 +
[[File:WriteCell.png|thumb|none|WriteCell action]]
  
 
* The WriteSymbol action Write current color in cell without moving
 
* The WriteSymbol action Write current color in cell without moving
 +
 +
[[File:WriteSymbol.png|thumb|none|WriteSymbol action]]
  
 
* The ReadPixel action Read RGB values of pixel to stack, pop to variables
 
* The ReadPixel action Read RGB values of pixel to stack, pop to variables
 +
 +
[[File:ReadPixel.png|thumb|none| ReadPixelaction]]
  
 
* The SetValue action Find value of cell symbol from RGB numbers
 
* The SetValue action Find value of cell symbol from RGB numbers
 +
 +
[[File:SetValue.png|thumb|none|SetValue action]]
  
 
* The SetMove action Read next Move direction from program table
 
* The SetMove action Read next Move direction from program table
 +
 +
[[File:SetMove.png|thumb|none|SetMove action]]
  
 
* The SetSymbol action Read next Symbol to write from program table
 
* The SetSymbol action Read next Symbol to write from program table
 +
 +
[[File:SetSymbol.png|thumb|none|SetSymbol action]]
  
 
* The SetState action Read next State from program table
 
* The SetState action Read next State from program table
 +
 +
[[File:SetState.png|thumb|none|SetState action]]
  
 
* The NewCell action Move left or right and set cell number of new location
 
* The NewCell action Move left or right and set cell number of new location
 +
 +
[[File:NewCell.png|thumb|none|NewCell action]]
  
 
* The Log action Write Step number, Symbol, Move, State, Cell number on new log line in black, saving and restoring
 
* The Log action Write Step number, Symbol, Move, State, Cell number on new log line in black, saving and restoring
 +
 +
[[File:Log.png|thumb|none|Log action]]

Revision as of 04:56, 30 June 2011

Turtle Art Code for Turtle Art Turing Machine

Click thumbnails to see full-size code blocks.

  • The Start action is the main procedure
Start action
  • The Setup action defines and initializes variables, and sets the orientation of the turtle
Setup action
  • The Tape action writes the initial tape. User can change values in repeat statements to change arguments.
Tape action
  • The Program action followed by the stack1 action writes the program table line by line. This is divided in two so that the segments fit in the Turtle Art workspace
Program action
  • The Execute action carries out the next program step until the halt state is reached
Execute action
  • The ToTape action Move turtle to current cell on tape
ToTape action
  • The ToProgram action Move Turtle to beginning of current program row to execute
ToProgram action
  • The WriteCell action Write current color to current cell, and move to next cell
WriteCell action
  • The WriteSymbol action Write current color in cell without moving
WriteSymbol action
  • The ReadPixel action Read RGB values of pixel to stack, pop to variables
ReadPixelaction
  • The SetValue action Find value of cell symbol from RGB numbers
SetValue action
  • The SetMove action Read next Move direction from program table
SetMove action
  • The SetSymbol action Read next Symbol to write from program table
SetSymbol action
  • The SetState action Read next State from program table
SetState action
  • The NewCell action Move left or right and set cell number of new location
NewCell action
  • The Log action Write Step number, Symbol, Move, State, Cell number on new log line in black, saving and restoring
Log action