Eso2D

From Esolang
Jump to navigation Jump to search

Eso2D is a Turing-complete 2D fungeoid made by User:PythonshellDebugwindow.

Memory

Eso2D uses an unbounded tape of wrapping 8-bit cells, therefore it has unlimited memory. It also has a pointer called the cell pointer (CP) to keep track of the current cell. The cell at the CP is often called the accumulator.

Instruction pointer

Eso2D’s IP can move in 4 directions—0 (up), 1 (right), 2 (down), and 3 (left). It starts out in the top-left corner of the program moving right, and if it ever goes out of bounds, it wraps around, so

v
>>

would start the IP at the top-left, turn it down, and then move it right forever because it keeps wrapping on the second row.

Auto-formatting

Before execution, Eso2D finds the longest row and pads all rows with spaces to that row’s length, and the same goes for columns.

Commands

Command Meaning
^ Set the IP's direction to 0 (up)
> Set the IP's direction to 1 (right)
v Set the IP's direction to 2 (down)
< Set the IP's direction to 3 (left)
, Increment the accumulator
_ Decrement the accumulator
X Reverse the IP's direction
~ If the IP encounters this command while moving up, it will change direction to down; down, to up; and left or right, if the accumulator is less than 85, it will move up, or if the accumulator is greater than 170, it will move down
` If the accumulator is 0, the IP will change direction to down, else nothing will happen; does nothing if the IP is moving down when it encounters this command
& Read a line of user input. Set the accumulator to the Unicode value of the first character of the input % 256, or set it to 10 if empty input is given
$ Read a line of user input. Set the accumulator to the input as a base-10 integer, or 0 if the input is not a valid base-10 integer
: Read a line of user input. For each character of the input, the next cell is set to its Unicode value % 256 (starting at the accumulator); the accumulator is set to 10 if empty input is given. For example, in the program :, the input ABC would set the first three cells to 65, 66, and 67. The CP is never changed by this command
# Output the (extended) ASCII character of the accumulator's value
* Output the accumulator’s value followed by a space
@ Exit the program (without raising an error)
0 Increment the accumulator by 5
1 Increment the accumulator by 50
2 Increment the accumulator by 97
3 Decrement the accumulator by 200
4 Decrement the accumulator by 5
5 Decrement the accumulator by 50
= If the accumulator is greater than 0, skip the next instruction
O Skip the next instruction no matter what
? Randomize the IP’s direction to either up, right, down, or left
} Increment the CP
{ Decrement the CP (if the CP is ever less than 0, the program will error and exit)
(space) Nop

All other characters, when encountered by the IP, will cause the program to error and exit.

Example programs

Hello, World!

10000,,#14444_#0,,##,,,#5444__#44__#10#00000_#,,,#4_#4___#54444,,,#@

Cat

:>#}`v
    @
 ^   <

Truth-machine

$`v
 >*@
  ^

99 bottles of beer

                       v
                      v>}}2,}310}3100}334,}20_}33,,,}25444}20}33,,}33__
                     v>}20,,}330,,}2}14_}00}14,
                    v>}244___}2}200}20_}25444}310}33__}11}330,,}14_}33
                   v>}33,,,}20,,,}330_}33,,}330
                  O>{ `
    >             v,,2<
                 v>*}#}#}##}#}#{{{{{_`,}}}}}}#>}#{{{{{#}}}}}}#{#{{{{{{#}}}}##}}}}#
                                     >,}}}}}} ^
                v>{{#{{{{{#}}}}}}}}#{{{#{{{{#}}}}}}}}#{{{{{{#}}#}}}}}#
               v>}#{{{{{{{{{##}}}}}}}}}}#}#
              v>{{{{{{{{{{{{{{{
             v>*}#}#}##}#}#{{{{{_`,}}}}}}#>}#{{{{{#}}}}}}#{#{{{{{{#}}}}##}}}}#}}}}}}}#
                                 >,}}}}}} ^
            v>{#}}#}#}#}#}#}#}#{{{#}#}}}#{{#}}}#{{#}}}#{{{{{#}}}}}}#
           v>{{{{{{{{{#}}}}}}}}}}##{{{{{{{#}}}}}}}}#}#{{{{{{{{{#{{{#
          v>}}}}}}}}}}}}}#{{{{{{{{{#}}}}}}}}}}#{{{{{{{{{#}#
         v>}}#{{{{{{{{{{{#{{{{{{{{{{{{{{{_`
  v                                       >
        v>*}#}#}##}#}#{{{{{_`,}}}}}}#>}#{{{{{#}}}}}}#{#{{{{{{#}}}}##}}}}#
                            >,}}}}}} ^
       v>{{#{{{{{#}}}}}}}}#{{{#{{{{#}}}}}}}}#{{{{{{#}}#}}}}}#
      v>}#{{{{{{{{{##}}}}}}}}}}}}#{##
     O>{`
    ^  }<
 v>24444,#}}#}}}}}#{{{{{{#}#}##}#}#}#}#{{{{{#}}}}}}#{#{{{{{{#}}}}##
v>}}}}#{{#{{{{{#}}}}}}}}#{{{#{{{{#}}}}}}}}#{{{{{{#
>}}#}}}}}#}#{{{{{{{{{##}}}}}}}}}}}}#{#@

External resources

  • An interpreter written in Python, along with some examples, on GitHub