SSEG
S²EG or SSEG (short for Single String Esolang Game) is a programming language written using only 2 symbols (0 and 1) made by Laptopcoder11.
It was created for a puzzle game of the same name released on itch.io in 2022 which can be played at: https://laptopcoder11.itch.io/sseg
Each instruction is made up of exactly 4 symbols (in this case effectively bits when using 1s and 0s). The functionality of an instruction is determined by the interpretation state, which can be either Normal or Stack based on the previous instruction. This gives a total size of (2^4)*2 or 32 possible instructions total. However, only 27 of these have a defined functionality as can be seen in the table below.
(first time editing a page here so please fix any formating issues)
Instruction Set
| Instruction | Normal | Stack | |
|---|---|---|---|
| 000n | decrease register-n | pop top value of the stack to reg-n | |
| 001n | increase register-n | push reg-n on top of the stack | |
| 010n | subtract reg0 - reg1 and put the answer in reg-n | (n = 0) pop and subtract top 2 stack values, push result to stack | (n = 1) Pop and discard the top stack value |
| 011n | add both registers and put the answer in reg-n | (n = 0) pop and add top 2 stack values, push result to stack | (n = 1) Swap top 2 stack values |
| 100n | move instruction pointer to n(0:left 1:right) by A instructions, where A is the next instruction as an integer value | Undefined | |
| 101n | set reg-n to A, where A is the next instruction as an integer value | Undefined | |
| 110n | if reg-n != 0 move instruction pointer left by A instructions, where A is the next instruction as an integer value | (n = 0) print top stack value in ascii without popping | (n = 1) print top stack value as an integer without popping |
| 1110 | if reg-0 != reg-1 move instruction pointer left by A instructions, where A is the next instruction as an integer value | Undefined | |
| 1111 | Switch interpretation state to Stack | Switch interpretation state to Normal |
Examples
Exponential counter
00100110001110000011
Counts upwards in reg-1 exponentially
Multiplication
000011110011111100110000111101101100011011110001
Multiplies the value in reg-0 with reg-1 and returns the result in reg-1
Fibonacci
001011110010111100101111000011110001111100111111001001101111001010001100
Generates the fibonacci sequence onto the stack using the value in reg-0 as index 0 and 1.