Omegaplex
Omegaplex, created by poiuy_qwert is a variant of the esoteric programming language Gammaplex created by Lode Vandevenne. It is definitely not as advanced as Lode Vandevenne's update to Gammaplex, Deltaplex, but is still an improvement in the opinion of the author. All the printable ASCII characters are used for commands.
Terminology
This just explains some things you will need to know if you are going to understand Omegaplex.
- Stack
- A 2-Dimensional floating point array(Stack[1024][1024]) which stores all the data in the program. Every entry is initialized to 0.
- StackPointer
- Which stack the program is currently using. Initialized to 1.
- CurX, CurY
- The X and Y positions in the program of the current command. Both initialized to 1.
- Direction
- The direction the program flow is headed: 1 = right, 2 = down, 3 = left, 4 = up. Initialized to 1 (right).
- DecimalNumber, StringNumber
- Dictates the behavior of the decimal and string systems explained below. Both initialized to 0.
- Resolution
- The screen resolution. Initialized to 255x255.
- GraphicPointer
- An array of intergers(GraphicPointer[6]) that point to stacks to be used in graphics, explained more below. Initialized to: 1 = 1, 2 = 2, ... 6 = 6.
- String
- Every number on the stack between until a number less than 0 or greater than 255 is considered an ASCII value to make a string.
- FileByte
- The current byte being pointed to in the file.
- Pop
- Takes the item off the top of the current stack, letting it be used for something or discarded.
- Push
- Puts a number on the top of the stack.
- Get
- Like pop, except that the item stays on the stack (a pop-then-push, or "peek").
Programs
Programs are text files having any extension (*.opx is the extension the author uses). The program starts in the top left corner of the text file (at 1,1), executes the command there, then moves into the direction specified by Direction onto the next command. Every line in the file should be of the exact same length in characters. If the program flow goes off the side of the file it will wrap around to the other side. For example:
\ \\ \Z
The program starts at the top left then:
- Does nothing ( ), then
- Moves to the right, then turns (\), then
- Moves down, then turns (\), then
- Wraps to other end, then turns (\), then
- Goes down then, then turns (\), then
- Moves right, then the program ends (Z).
It can be modeled as such:
─┐ ┐└ └─
Commands
This is a list of all the commands:
CMD | ASCII | Description |
> | 62 | Increase StackPointer. |
< | 60 | Decrease StackPointer. |
s | 115 | Pop a value, then set StackPointer to it. |
S | 83 | Push StackPointer. |
? | 63 | Pop a value, if it's zero, skip the next command. |
/ | 47 | Change Direction as if bouncing off a 45° mirror (1 becomes 4, 2 becomes 3, 3 becomes 2, 4 becomes 1). |
\ | 92 | Change Direction as if bouncing off a 45° mirror (1 becomes 2, 2 becomes 1, 3 becomes 4, 4 becomes 3). |
{ | 123 | Change Direction to 1 (right). |
} | 125 | Change Direction to 3 (left). |
g | 103 | Pop x, then y, then go to (x,y) and start executing from that command. |
G | 71 | Pop x, then y, then go to (x,y) and push CurX, CurY, and Direction. |
B | 66 | Pop x, y, and z, then go to (x,y) and change Direction to z. |
32 | Do nothing(NOP). | |
# | 35 | Set DecimalNumber to 0. |
; | 59 | Jump next command. |
^ | 94 | Jump next pop commands. |
( | 40 | Push Stack[pop] on current stack. |
) | 41 | Push currecnt stack on Stack[pop]. |
d | 100 | Pop and do nothing. |
D | 68 | Pop, pop that many values, then do nothing. |
y | 121 | Pop, then push push. |
Y | 89 | Pop, then get that many times then push them. |
[ | 91 | Shift pop items pop times to the left. |
] | 93 | Shift pop items pop times to the right. |
+ | 43 | Push pop + pop. |
- | 45 | Push pop - pop. |
* | 42 | Push pup * pup. |
: | 58 | Push pop / pop. |
% | 37 | Push pop % pop. |
~ | 126 | Push pop ^ pop. |
R | 82 | Push the square root of pop |
M | 77 | Execute math function pop. |
= | 61 | If pop equals pop push 1, else push 0. |
_ | 95 | If pop is smaller than pop push 1, else push 0. |
& | 38 | Push binary and of pop and pop. |
| | 124 | Push binary or of pop and pop. |
X | 88 | Push binary xor of pop and pop. |
! | 33 | If pop is 0, push 1, else push 0. |
v | 118 | Push pop - 1. |
V | 86 | Push pop + 1. |
t | 116 | Push ticks since program start. |
T | 84 | Push ticks since last t or T command. |
r | 114 | Set Resolution to pop x pop. |
' | 39 | Push 255 on the stack. |
f | 102 | Toggle graphic style pop. |
F | 70 | Push graphic style pop. |
x | 120 | Set GraphicPointer pop to pop. |
p | 112 | Draw a pixel. |
l | 108 | Draw a line. |
c | 99 | Draw a circle. |
b | 98 | Draw a box. |
h | 104 | Convert color pop,pop,pop to HSV and push the result. |
H | 72 | Convert HSV pop,pop,pop to color and push the result. |
w | 119 | Push the width of the screen. |
W | 87 | Push the height of the screen. |
i | 105 | Push 0 then input a string at (pop,pop). |
I | 73 | Push 0 then input a string at Stack[pop]. |
n | 110 | Input a number at (pop,pop). |
N | 78 | Input a number at Stack[pop]. |
m | 109 | Push mouse Y and mouse X coordinates on stack. |
u | 117 | Set debug mode to pop. |
U | 85 | Set debug mode to 0. |
q | 113 | Get ASCII of instruction at (pop,pop) to pop. |
Q | 81 | Get ASCII of instruction at Stack[pop] |
e | 101 | Edit the instruction at (pop,pop) to be ASCII pop. |
E | 69 | Edit the instruction at Stack[pop] to be ASCII pop. |
" | 34 | Read more about this command in the string section. |
~ | 126 | Mirror string. |
` | 96 | Duplicate string. |
o | 111 | Pop and output as an integer. |
O | 79 | Pop up to a number <1 or >255 and output all as a string. |
k | 107 | Pop then pop that many numbers and convert them to a string. |
K | 75 | Pop up to a number <48 or >57 put them together as an integer and push it. |
@ | 64 | Redraw screen. |
C | 67 | Clear the screen. |
0-9 | 48 | Digit commands. |
. | 46 | Decrease DecimalNumber by 1 unless its 0.2. |
, | 44 | Increase DecimalNumber by 1 unless its 2. |
j | 106 | Push a random integer between pop and pop. |
J | 74 | Push a random float between pop and pop. |
$ | 36 | Sleep until a button is pressed. |
L | 76 | File opening command. All file commands explained bellow. |
a | 97 | Decrease FileByte. |
A | 65 | Increase FileByte. |
P | 80 | Read the current byte in the file then increase FileByte. |
z | 122 | Write string to file starting at FileByte. |
Z | 90 | End program(Essentially {}). |
All characters on the keyboard except 9(horizontal indent, tab), 10(line feed, enter), and 13(carriage return, enter) are commands.
Note: All commands are case sensitive!
Systems
These are some special systems designed to make Omegaplex esier to use.
Files
The Files system is used to interact with *.txt files in the same directory as the program. When you use the L command, if there is no file open it will take the string off the stack and open the file with that name, then push a 1. If there was a file open when the L command was used it closes the file the pushes a 0. When you open a file FileByte gets reset to 1, you can then increase or decrease it with a and A. The P command pushes the characters ASCII at FileByte, then increases FileByte then pushes 1 if its EOF or 0 if not. The z command writes the string on the stack to the file starting at the FileByte, increasing the FileByte every character.
Strings
The Strings system uses StringNumber which is a boolean variable initialized to 0. The " command is used to toggle StringNumber. When StringNumber is 1 every character read from the program is pushed as an ASCII value onto the current stack. If StringNumber is 0 the commads are executed regularily. There are also some commands that can be executed inside a string by prefixing them with a ~. The commands that can be used in a string are:
/\{}; #
There are also special commands for strings, they are also prefixed with ~. They are:
2-9: Execute the next N characters as commands.
~: Push the ASCII of ~.
Decimals
The Decimal system uses DecimalNumber which is anything from 2 to -2 that is initialized to 0 and can be changed with '.' and ','. Every command except the ones below reset the DecimalNumber to 0:
0123456789 .,/\{}
The commands 0-9 do the following:
DecimalNumber | Description(N is the command used) | Example on stack 1.1,2,3 and calling 9. |
2 | Pop, place N on the front of the number, and push. | 91.1,2,3 |
1 | Pop, place N on the end of the number, and push. | 19.1,2,3 |
0 | Push N on the stack. | 9,1.1,2,3 |
-1 | Pop, place N on the front of the decimal, and push. | 1.91,2,3 |
-2 | Pop, place N on the end of the decimal, and push. | 1.19,2,3 |
Math
The M command executes a math function depending on pop. Depending on the function up to the next 2 stack values can be poped as u and v. The functions are:
- sin(u): sine
- cos(u): cosine
- tan(u): tangent
- sec(u): secant
- csc(u): cosecant
- cot(u): cotangent
- asin(u): inverse sine
- acos(u): inverse cosine
- atan(u): inverse tangent
- asec(u): inverse secant
- acsc(u): inverse cosecant
- acot(u): inverse cotangent
- sinh(u): hyperbolic sine
- cosh(u): hyperbolic cosine
- tanh(u): hyperbolic tangent
- sech(u): hyperbolic secant
- csch(u): hyperbolic cosecant
- coth(u): hyperbolic cotangent
- asinh(u): inverse hyperbolic sine
- acosh(u): inverse hyperbolic cosine
- atanh(u): inverse hyperbolic tangent
- asech(u): inverse hyperbolic secant
- acsch(u): inverse hyperbolic cosecant
- acoth(u): inverse hyperbolic cotangent
- exp(u): exponential: e^u
- ln(u): natural logarithm (base e)
- exp(-(u * u)): standard normal distribution
- sign(u): returns -1, 0 or 1 (the sign of u)
- atan2(v, u): computes the principal value of the arc tangent of v/u, using the signs of both arguments to determine the quadrant of the return value
- log_u(v): base u logarithm of v, that is: ln(v)/ln(u)
Graphics
When using the commands p, l, c, and b to draw, you need to have coordinates and colors for them. To make things easier for graphics, you must set the GraphicPointers to a Stack where you will define everything for the graphics. Setting a GraphicPointer is done with the x command. The x command pops a number from the stack to choose which setting to change, and those settings are:
- Coordinates A (Top value is x, 2nd value is y)
- Coordinates B (Top value is x, 2nd value is y)
- Color A (Top value is r, 2nd value is g, 3rd value is b)
- Color B (Top value is r, 2nd value is g, 3rd value is b)
- Radius
- Transparency (1-256, 1 being opaque, 256 being transparent)
There are also graphic styles that can be toggled with the f command. The f command also pops a number from the stack to choose which style to toggle. The styles are:
- Enable transparency
- Multiply blending
- Make underlying pixels negative color (effect visible if transparency or blending is used)
- Do not draw over pixels with Color B
- Only draw over pixels with Color B
- 50% dot pattern
- Less dots than above
- Horizontal lines
- Vertical lines
- Invert pattern (transparent pixels are now filled ones and vice versa)
- Horizontal gradient
- Vertical gradient
- Text background as Color B (with gradient the background is opposite gradient of text)
4 and 5 together form "draw with (Color A + Color B)/2 over Color B, draw normally over the rest"
Horizontal and vertical gradient together make 45Рgradient. The gradient is from one side of the screen to the other side, and uses Color A and Color B. 4 and 5 are disabled when gradient is enabled.
Dot and stripe patterns mixed form dotted line patterns (the combination of all removed pixels).
Implementation
The author of Omegaplex has asked and was allowed by Lode Vandevenne to use the Gammaplex interpreter source as a base for the Omegaplex interpreter. This means the creation of the interpreter will go fast.
Example Programs
These programs work in theory, but since the language is unimplemented there is no way to know if they do.
Hello World!
Outputs "Hello, World!" to the screen.
"Hello, World!"~OZ
Omegaplex Demo
The Gammaplex demo edited to work in Omegaplex.
"Omegaplex"~>0y'>'yy>\ / f21xy4xy3xy2/ {t650:2M124*124+t4\ \C@O`s1+29*29M2:00}