esolang

Simplex

A pointer on a grid of numbers, and one character per thing to do with it.

Conor O'Brien, 2015 · Turing complete: unknown · ●●○ moderate · esolangs.org

Tested with 5 known programs · Hello World on Try It Online: identical except the line end · Test method

Run it

Expected: Hello, World!

The idea

Conor O'Brien started Simplex in 2015. The program itself is a single line of tokens, read left to right, but the data is two dimensional. The interpreter calls the grid a slate, and there can be several slates side by side.

Read the story

Most operators take their operands from cells around the pointer. Which cells is set by two motions. At the start the first operand is the cell under the pointer and the second the cell to its left, so 6>7* leaves 42 under the pointer. Lowercase c r l u d change the first motion and uppercase C R L U D the second.

The machine

TokenDoes
123Write the number into the cell under the pointer
"text"Lay the text out backwards along the direction, one character code per cell
+ - * / :Combine the two operands, or copy the second, into the pointer's cell
q p _One less, one more, minus
o h HPrint a number, a character, or every character back to the first 0 and a newline
> < ^ v #Move; # moves along the direction, ~ and ` turn it
[ ]Loop while the cell is not 0
{ }Skip when the cell is 0
( )nRepeat n times
fSet the fuel; each move uses one, and an empty tank stops moves and loops

A string runs to the last quote in the whole program, so a program has room for one. Numbers are big decimals with 100 digits in the reference; this implementation keeps whole numbers below 10^21 and stops on anything else. There is no input.

Example

The countdown keeps its counter at the start of the row and uses the next cell for the newline, 10.
Expected: 5 4 3 2 1
Expected: ABC

The countdown keeps its counter at the start of the row and uses the next cell for the newline, 10.

Patterns it teaches

Try this

  1. Print the numbers 1 to 10.
  2. Add two numbers with + after setting the second motion to the right with R.
  3. Hard: print a string twice. There is only room for one string literal.

Further

Also in Golfing

Write your own in Run Convert a program from Simplex

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: simplex.

Command line

shib run simplex -e '6>7*o'
shib manual simplex

Source

Module
langs/tio/ports.js
Interpreter
langs/tio/simplex.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org