Programs work on a linear memory tape, infinite to both directions. Each memory cell contains any of two values. The initial value is usually considered 'zero', and the changed value 'one'.
A source code is a bitmap, where each pixel defines a statement:
- White (FFFFFF): does nothing
- Yellow (FFFF00): input bit is stored in current cell
- Black (000000): current cell is written to output
- Gray (808080): flips current cell
- Green (00FF00): advances memory pointer to one direction by one cell
- Red (FF0000): advances memory pointer to the other direction by one cell
- Blue (0000FF): changes direction of execution, depending on the value of the current cell (see below)
- Colors other than these should generate a runtime error if reached.
Execution starts at the top left corner going to the right. If a blue pixel is reached, the instrucion pointer turns either left or right by 90 degrees. If the current cell contains its initial value, the instrucion pointer turns right, otherwise it turns left. Note that before turning it goes back by one pixel, like if the blue pixel wasn't reached (this is to ensure Turing-completeness, see image below). If execution reaches any side of the bitmap, the program halts.
Although the exact operation of the black and yellow statements is not strictly defined, it is strongly recommended that any of the following characters is considered as
- initial cell value: 0 n N f F
- changed cell value: 1 y Y t T
The following example inputs a four-digit number (in base two), adds one to it, and then outputs the result as a five-digit number (to handle possible overflow). To make it work with larger numbers, just extend the input and output parts.
The following example outputs the bits of 'Hello World!':
The following code calculates sqrt(2) to infinite precision:
BiTrax is Turing-complete.
A fully functional source code editor, interpreter, debugger, etc. is coming soon!