esolang

OW-1

Two cells, one buffer and a grid of arrows. Every sum lands in the buffer first.

Potato Imaginator, 2022 · Turing complete: yes · ●●○ moderate · esolangs.org

Tested with 5 known programs · Test method

Run it

Expected: 720

The idea

Potato Imaginator made OW-1 on 12 June 2022, after Befunge and assembly language. OW stands for Old Woman. There is no stack. The machine has two cells, A and B, a pointer that sits on one of them, and a buffer C. Arithmetic always reads A and B and writes C, so a program keeps moving numbers between the three with swaps and copies.

Read the story

The only test is T. It turns the path clockwise when C is not 0, so every loop is a ring of arrows that T steps out of once C reaches 0.

The machine

CharDoes
^ v < >Point the path up, down, left or right
?Point it a random way
.Move the pointer between A and B
+ - * / e %Store A+B, A-B, A*B, A/B, A to the power B or A modulo B in C
S sSwap the pointed cell with C; swap A and B
c pCopy the pointed cell into C; paste C into it
i d 0-9Add 1, take 1, set a digit
#Print C
TTurn clockwise unless C is 0
xEnd

The program starts in the top-left corner moving right. # prints C on its own line, and the grid wraps at its edges.

Example

The factorial of 6.

The factorial of 6. B keeps the product and A counts down. T sees the counter in C and sends the path down into the loop until it is 0.

The factors of 48. B runs from 2 upwards, % tests it, and - ends the loop when B reaches A.

Expected: 1 2 3 4 6 8 12 16 24 48

The absolute difference of 5 and 8. A and B are counted down in turn until one of them is 0.

Expected: 3

The specification also prints sums, square roots, Fibonacci numbers and primes, which run forever. Its Minsky machine translation reads T the other way round and does not run under the rules of the table.

Patterns it teaches

Further

Two-dimensional languages

Cell-based

Write your own in Run Convert a program from OW-1

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: ow-1.

Command line

shib run ow-1 -e '6.1>*p.dSTS#x
         S
         .
   ^     <'
shib manual ow-1

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/ow-1.js

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

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