!		AutoBoat - Inspired by the language "Boat": Another simple 2-dimensional language (Written in AutoIt)
			Please view in "Terminal" font with word-wrap off.
         ______________________________________________________________________________
		Explanation:
			this language has single-character operators that
			manipulate a pointer and a buffer.
			However, instead of left-to-right, the code has operators to
                        set the direction of subsequent operators.
         ______________________________________________________________________________

Changes: File operations, Input/Output changes, "s" and "$"  10:02 AM 6/7/2010


Introduction
	The first character processed is in the upper-lefthand corner and the default movement direction is rightward.

	The structure allows an person to construct a circuit that performs an action
	and well-formed structures can be separately reused like functions.

List of internal values:
	A 128-byte buffer
	A pointer/position to a byte in the buffer
	The direction of program flow
	Input "handle"
	Output "handle"


Input/Output
	Notes:
		Input operations reference an int that can have the following Values
			0 = Console Text (stdin)  (via _getch in msvcrt.dll)
			Any value>0 = Previously-opened File handle
		Output operations
			0 = Console Text (stdout)
			1 = Console Error Text (stderr)
			Any value>1 = Previously-opened File handle
	Operators:
        :        *** gets a byte from input
                      if the character is null, the current direction is turned clockwise
                      if the character is not null, it is saved to the current byte under the pointer
                      NOTE: for display compatibility reasons input 0x0D's (CR's) are changed to 0x0A (LF)
	.        *** outputs the byte under the pointer as a character
	s        *** print string from current position until either a null or the end is reached.
                      (does NOT change the pointer/curent byte position)
	#        *** outputs the byte under the pointer as an integer
	i        *** set input  "handle" to the value of the current byte (0 is reserved for console)
	o        *** set output "handle" to the value of the current byte (0 is reserved for console, 1 for error text)
	;        *** close input  handle (files only)
	,        *** close output handle (files only)

File control
	Notes:
		File operations requiring filenames (exists/create/delete/open/execute) read a null/end-terminated filename from the current byte. (does not move the pointer)
		File operations saving a "handle" can have should have handle used in Input/Output operations 
	Operators:
	@        *** file exists? turn clockwise if not 
	`        *** create file
	~        *** delete file
	r        *** open file for reading, sets current byte to the "handle" (failure turns clockwise and sets byte to 0)
                      NOTE: "con" will automatically set the byte to 0 (success)
	w        *** open file for writing, sets current byte to the "handle" (failure turns clockwise and sets byte to 0)
		      NOTE: "con" and "err" will automatically set the byte to 0 and 1, respectively. (success)
	x        *** execute file (shellexecute) 
Generic use
	Operators:

	< > v ^  *** Directional operators - specify the direction for the next character in the code (assume they are arrows)
	= |      *** "wires"... characters that connect a straight line of code but do not do anything themselves.
                     "wires" can be added to point to code that is on the other side of the document or to aide
	              in visualizing the program flow.
	                NOTE: at this time "wires" are not mapped to find the next operator - they are simply moved along until one is found.
	/        *** increases the pointer (if you attempt to increase past 127 (end of buffer), the current direction is turned clockwise)
	\        *** decreases the pointer (if you attempt to decrease past 0, the current direction is turned clockwise)
	+        *** increases the value of the byte under the pointer
	-        *** decreases the value of the byte under the pointer
	%        *** if the byte under the pointer is null or 0xFF, the current direction is turned clockwise (passthrough otherwise)
	!        *** Ends the current code (returns if in a segment)
	0-F      *** multiply the value of the byte under the pointer by the hex value (using 0 basically nulls the byte)
	"        *** marks the beginning and ending of a string to add to the buffer at the current pointer position
	              Strings ARE defined in the direction of the code (vertically, right-to-left, etc)
                      The pointer value is increased after setting each character, so it will end up on the byte after the string
                      given the string does not reach the end of the buffer.
                      NOTE: if the string reaches beyond the end of the buffer, the end is trimmed.
	$        *** change pointer to the beginning position of the previous string entered with ""
        z        *** sleep(10), sleeps for 10ms
	[ ]      *** Begins and ends a coordinate to a code segment.
                      Any directions except backwards (from original program) is continued from the right bracket
	              If the code results in a backwards direction, it is instead continued clockwise from the left bracket
                      NOTE: Code segments are relative in direction to the code calling the segment. 
                           eg: segments ending rightward have no change in direction (default direction), downward turns clockwise, upward turns counterclockwise
                      NOTE: In a segment, ! ends the code segment instead of ending the program



___________________________________________________________________
Simple Programs:





Box/Pinwheel infinite Loop
>===v
|   |
|   |
|   |
^===<

and

>v
^<



Right-left (back and forth) infinite loop

>======<

and

><

Down-up infinite loop

v
^


A more obscure infinite loop... (requires the current buffer byte to be null)

>===v
    |
   %|%
   %%%


Allowed crossing [under] a "wire" since direction is definite
and wire characters do not distinguish direction:


Start

>==========v
           |
     >=====|===!     End
     |     |
     |     |
     ^=====<

Two added to the byte at position zero (initially value 0), making it's value 2, then the program ends:

>==++==!


Two is added to byte zero (making it 2), the byte is not null, so the character is printed and the program ends:

>==++==%==.==!
       |
       |
       !

Alternative circuit-like representation of the above operation
>==++==%==.==!
       |     |
       |     |
       >=====^


Nothing happens to byte zero, the byte IS null, so the program ends without printing (Downward wire taken from '%'):

>======%==.==!
       |     |
       |     |
       >=====^

We can optimize that code (for operation, not readability) by removing the "wires"
if they aren't needed for to align the operators.

Miniature version of the above code:


>==%.!
   >=^


For optimum readability, pad each operator with at least 2 "wire" characters or 2 spaces between
it and another character (where applicable) to keep each operator obvious to the reader.

This general rule/suggestion may require lengthening "wires" or spaces in other areas 
past 2 characters; 2 is just a minimum.


However, even in "miniature versions" I keep still space the Starting and Ending wires for 
reusability, even if the code's function is not obvious by glancing at it.


______________________________________________
Generic Examples:

Safe Cat (output what is input without null or 0xFF)
>=====:==.==v
|     |     |
|     |     |
^=====<=====<

Miniature version (without as many "Wires")

>:.v
^<=<




Unsafe Cat (output what is input)
>==:==>==.==v
|  |  |     |
|  |  |     |
|  >--^     |
|           |
^===========<

or

>:>.v
|>^ |
^===<




__________________________________________________________________________________________
Advanced Examples:

Resetter - Changes the pointer to position 0 from any current position  (unterminated, reusable code section)


In              Out

     >=====v
     |     |
     |     |
>====\==<  >====>
     |     |
     |     |
     >=====^

   Miniature version (without as many "Wires")

   >=v
>==\<>==>
   >=^


Top-up version

  ^
  |
  |
 >^<
 |v|
 ^\^
  |
  |
  ^


The first part ">\<" merely loops a decrement of the pointer with "\"
until it reaches 0, after which it turns the code-processing direction clockwise,
forcing either the upper or lower wire to be used. (up-down is clockwise from left-right)
__________________________________________________________________________________________


Incrementer - Increments all bytes from the current pointer position to the last position
		Change the "+" operator to "-" to make a Decrementer
                Change the "+" operator to "0" to make a Clearer (all bytes to null)

In              Out

         >=====v
         |     |
   v=====|==<  |
   |     |  |  |
   |     |  |  |
>==>==+==/==^  >==>
         |     |
         |     |
         >=====^

   Miniature version
     >=v
   v=|<|
>==>+/^>==>
     >=^



Note: the function loops the process of Add 1, Go to next 1
until the '/' operator is limited by the end of the buffer.

This code was modified from the "resetter"

____________________________________________________________________________________________________

Safe Printer - Prints the ENTIRE byte buffer as characters without nulls
		Starts from the current pointer position, ends on the last byte

Without the "s" operator:

In                      Out

>==>=======%==.==v  >==>
   |       |     |  |
   |       |     |  |
   |       v=====<  |
   |       |        |
   |       |        |
   |    v==/        |
   |    |  |        |  <-- For "/" here Left is EOF, Down is success
   |    |  |        |
   ^=======<        |
        |           |
        |           |
        >===========^

Miniature Version

>==>=%.v>==>
   | v=<|
   |v/  |
   ^=<  |
    >===^






		The '%' filters nulls to a different path while the '/' increases the position and
		changes the path after the last byte
____________________________________________________________________________________________________
If you don't exactly need the Safe Buffer Printer you may 
just want to print a specific string from the buffer


String Printer - Prints from current position until Null or Buffer End is reached
NOTE: The new "s" operator is an alternative to this which will not modify the current position (Pointer)


>===>==%==.==/==v
    |  |     |  |
    |  |     |  |
    |  >=====>==|===>
    |           |
    ^===========<


>===>%./v
    |>=>|===>
    ^===<

____________________________________________________________________________________________________


Printing a short string  (complete program)
Not the most simple method - just showing ways to define/append strings to the buffer w/ program flow.




>==v  >=====" World! "======v
   |  |                     |
   "  |  v=="?uoy era woH"==<
   H  |  |
   e  |  |
   l  |  |
   l  |  |         >=v
   o  |  >======>==\<>==>=====>==>=%.v>==>=====!
   "  |            >=^           | v=<|
   |  |                          |v/  |
   >==^                          ^=<  |
                                  >===^

                |_______|
                   |
                Resetter      |__________|
                                   |
                                SafePrint of entire buffer


^^^ Adding characters to the buffer, resetting the position to 0 and printing them all out "safely"
should print out "Hello World! How are you?"



___________________________________________________________________
Other Nonsense:


Fancy way of doing **Nothing**  with coiled wire (unterminated, reusable code section)

In

>==================v
     >============v|
     |>==========v||
     ||>========v|||
 v===|||========<|||
 |   ||^=========<||
 |   |^===========<|
 |   ^=============<    Out
 |
 >======================>




___________________________________________________________________
Obfuscation madness! 

AutoBoat is hard for humans to read when not spaced-out;
it can be hard to discern program flow/operation from surrounding text.


Hiding in plain sight

v>=>+86++./==>=>>v
++v/!<v==/.+++68+<
8/8.86v!=|+>6/|/!|
6=.+|!|^++v6+==v.^
.!>6|.v!</|.!8^|+^
/8|8^v>+86++++.!>v
|>!+6=8>v8==/<66.|
>==^!68=>.+/.8^=6!


Less hidden version of above (just follow the flow)

v  >+86++./==>=>>v
+  /  v==/.+++68+<
8  .  v           
6  +  |
.  6  v           
/  8  >+86++++.!  
|  +              
>==^              

Both print "01234"

+86./+86+./+86++./+86+++./+86++++.!
 0    1     2      3        4

Which could have been shortened to the following or probably even shortened more:

+86.+.+.+.+.!


