This is a Case Sensitive Language and works well with American Keyboard Layout.
Inputs are given as either numbers 0-9 , specific alphabets or special commands.
It has two cells A and B and a Buffer called C.
All three cells can only store numbers ( Positive , Negative , Decimal ) .
Operations Performed on A and B are stored in C.
There is a Pointer that is either at Position A or Position B. The Pointer is moved by calling " . " Command.
Current Pointer Position has Light Blue Background.
Hitting ' z ' key will Pause / Play the Program.
Press ' r ' to Reset.
Press ' o ' to Enable / Disable Output Display.
In edit mode , Press Arrow keys to move position and enter below commands.
Press " Delete " or " Backspace " Key to delete command at a position.
||Changes Direction to Up.|
||Changes Direction to Down.|
||Changes Direction to Left.|
||Changes Direction to Right.|
||Changes Current Pointer Position. Switches between A and B|
||Changes Direction to Random Direction. ( Up / Down / Left / Right )|
||Stores A + B into C.|
||Stores A - B into C.|
||Stores A * B into C.|
||Stores A / B into C.|
||Power Function : Stores A ^ B into C.|
||Modulo Function: Stores A % B into C.|
||Swaps value between Current Pointer and C.|
||Swaps A and B values.|
||Copies Current Pointer Value into C.|
||Pastes C Value into Current Pointer Variable.|
||Increment Current Pointer Value by 1.|
||Decrement Current Pointer Value by 1.|
||Prints C value to Output Display.|
||If C = 0 then move in same Direction , else Rotate Direction by 90 ( Clockwise ).|
||Assign value of 0-9 to Current Pointer.|
Sum of Natural Numbers
>i.p+#.v ^ <
6.1>*p.dSTS#x S . ^ <
Change starting value of 6 to any number to get it's Factorial.
1c.1c#.#>p+.#v ^ <
1c>#+.pv ^ <
2c#i.2>%T.i.v i - ^ T 2 c # . i . ^ < <
Factors of a Number
1c#6.8*2.p.>%TS#S-Tx i i ^ < <
Above prints Factors of 48
>5.p+.p.5d-p/.p#v ^ <
Change all values of 5 to any number to get it's Square Root.
Another one is:
1c>p.p*pi/p.7i*#v ^ <
Change all values of 7 to any number to get it's Square Root.
v >+v . 1 . > >?<>p.2/.p.9i*.p.9i*.v 0 . p >+^ . 1 ^ .p./i9.p./i9.#p.-p%<
Absolute Difference of Two Numbers
5.8.>c T.c#x d . c ^.dT . i c # x
Here A = 5 and B = 8
Prints Absolute Difference of A and B .i.e; | A - B |
Minimum of Two Numbers
9.6.>d.dSiS.STS#x S . S ^ ST S # x
Maximum of Two Numbers
7.4.>d.dSiS.STSp+#x S . S ^ ST S p + # x
1.1>/p.1+.p#v ^ <
Golden Ratio φ = 1.618033988749....
OW-1 can be proven Turing Complete by compiling Minsky Swap to it.
>cTv>d > ^
< below the
v and a
^ at the destination
Make sure no jump paths collide.
At the end add an
>x to halt the program.
Here's an example:
The Minsky Swap code
inc();inc();swap();decnz(0);inc(); turns into
>i>i>.>cTv>d>i>x > ^ ^ <
Which ends with both registers at 2, the expected result.