esolang

Ropy

The program is a rope of characters, and the pointer crawls along it.

Torbjørn Marø, 2012 · Turing complete: yes · ●●● hard · esolangs.org

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

Run it

Expected: 100

The idea

Torbjørn Marø made Ropy in 2012 for the PLT Games, where the task was a Turing tarpit; Steffen Hageland later added memory. There are no arrows. The pointer starts on the first character that is not a space and steps to a neighbouring character, in any of eight directions, never straight back. Where the rope forks, the top of the stack decides. It takes the first branch clockwise from where it came in, or counter-clockwise when the top is 0. Where the rope ends, the program ends, and the top of the stack is printed.

The machine

A stack of integers and strings, and a memory of numbered cells. This implementation follows the Ruby interpreter TIO keeps in TryItOnline/ropy.

CommandDoes
0-9Push the digit
+ - * / %Pop a then b, push a op b
&Join the top two as digits, top first
< > ?Swap, duplicate, drop
!1 for 0 or less, else 0
"Turn the whole stack into one string, top first
#Pop and print
[ ]Store a value at an address; fetch it

Every other character does nothing, but the pointer can walk on it, so letters and lines both make rope. The order is top first everywhere, so - on 5 then 3 gives 3 minus 5.

Example

The second program prints 30 with #, pushes 2 and runs off the end of the rope, which prints the 2.
Expected: 302

The second program prints 30 with #, pushes 2 and runs off the end of the rope, which prints the 2.

Patterns it teaches

Further

Two-dimensional languages

Stack-based

Write your own in Run Convert a program from Ropy

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run ropy -e '001&&'
shib manual ropy

Source

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

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

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