UberDraw - By Dan

Commands:
---------

Commands are written in the form: <command> <parameters>
Multiple commands can be written on the same line, separated by a semicolon: ';'
The available commands are listed below:

Command		|Description					|Syntax			|Examples
----------------+-----------------------------------------------+-----------------------+---------------
fd		|Moves the turtle forwards			|fd <amount>		|fd 5
bk		|Same as forwads, but moves backwards		|bk <amount>		|bk 2.6
lt		|Rotates the turtle left			|lt <amount>		|lt 90
rt		|Rotates the turtle right			|rt <amount>		|rt 45.5
home		|Resets the position and rotation of the turtle	|home			|
clear		|Clear the screen				|clear			|
hide		|Hides the turtle				|hide			|
show		|Unhides the turtle				|show			|
lift		|Can move around without drawing		|lift			|
drop		|Resumes drawing				|drop			|
colour		|Changes the pen colour				|colour <r> <g> <b>	|colour 0 255 0
repeat		|Repeats the commands				|repeat <num> [commands]|repeat 3 [fd n; rt 90]
halt		|Stops any current loop				|halt			|
speed		|Changes the drawing speed (default = 4)	|speed <num>		|speed 5
run		|Executes a series of commands from a file	|run <filename>		|run circle.txt


Repeats:
--------
The repeat command allows you to repeat a set of commands a given amount of times.
the synax is: 

repeat <num> [commands]

Where num is the number of times to repeat the commands, and commands is the set of 
commands you wish to run. the commands are separated by the semicolon: ';'

You are able to replace the parameters of the commands: fd, bk, lt, rt, colour
with "n", which, during execution is replaced with the current repetition. 
For example, consider the following loop:

repeat 3 [fd n; rt 90]

this is the same as writing the following out separately:

fd 1; rt 90
fd 2; rt 90
fd 3; rt 90
fd 4; rt 90

Repeats can also be nested. For example:

repeat 179 [repeat 3 [fd 30; rt 90]; rt 2]

While a loop is being drawn, you can at any time type "halt" (or any other command) to halt the
execution of the script.


Arithmetic:
-----------
There is arithmetic support for the commands: fd, bk, lt, rt, and colour.
The list of available operators are as follows:
+	Addition
-	Subtraction
*	Multiplication
/ 	Division
^	Power

Sums can be enclosed in parenthases: ( ) to be evaluated first. For example:
2+(4*4)
will be evaluated to:
2+16
then 18

'n' is also evaluated in repeats, and defaults to 1 outside of repeats.
Sums should not contain any spaces.

The power operator ('^') clamps any values higher than 127 to 127.

Scripts:
--------
Commands can be written in a file, and read using the "run" command. The file is opened
and executed line-by-line. For example, consider the following:

clear; home; repeat 3 [fd 20; rt 90]

Can be written in a .txt file (for example example.txt) as:

clear
home
repeat 3 [fd 20; rt 90]

The commands would then be run by typing: "run example.txt"

Comments can also be added into scripts. All text before the # symbol is sent to the parser.
Any text to the right of the # symbol is ignored. For example:

# Clear the screen
clear
home # Set the turtle to the center of the screen
repeat 3 [fd 20; rt 90] # Draw a square

is a valid script file.

In order for scripts to work, they must be placed in the same directory as the executable


Example Patterns:
-----------------
Try putting these into the command line:

repeat 200 [fd n; rt 90]
colour black; repeat 200 [fd n; rt 90; colour 0 n 0]
repeat 179 [fd 100; bk 200; fd 100; rt 2; fd 1]
hide; repeat 7 [repeat 3 [fd 50; rt 90]; rt 45]
colour black; repeat 89 [repeat 89[fd 2; rt 4]; rt 4; colour 0 n 0]
repeat 89 [repeat 89[fd 2; rt 4]; rt 4]
repeat 179 [fd 100; bk 200; fd 100; rt 2; fd 0.25]
colour green; repeat 44 [repeat 89 [fd 2; rt 4]; rt 8; repeat 3 [fd 50; rt 90]]

Notes:
------ 
The latest Direct3D runtime is required (August 2006).
Users without the August 2006 runtime should place d3dx9_30.dll (supplied)
into the same directory as the executable. It should then run properly.


Changes:
--------
v0.81 	- New command added: "color" (provides the same function as "colour")
	- Fixed a crash where the turtle would overflow the vertex buffer
	- Fixed 2 memory leaks in the parser

v0.9	- Added arithmetic support
	- Added incremental drawing
	- Added the "halt" command
	- Added the "speed" command
	- Fixed bug where in some circumstances, after dropping the pen a line
	  and then drawing, a line would be drawn from the center

v0.91	- Rewritten parser to properly evaluate "n" in nested repeats
	- "repeat n" now works as expected
	- Added the Power operator: '^'
	- Fixed bug where the text to the right of the caret was not parsed when enter was pressed

v1.00	- Implemented support for reading commands from a file using the command "run"
	- Fixed a crash when square brackets for repeat were empty
	- Fixed a crash when the first character read was a semicolon (;)


Known Issues:
-------------


Todo:
-----
