Ropy

Ropy is a stack-based, two-dimensional esoteric programming language invented in 2012 by Torbjørn Marø. In many ways it works the same as Befunge, but with a different movement strategy of the instruction pointer.

The language was implemented as an entry into the PLT Games (link no longer exist), where the task was to create a Turing tarpit. Support for random access memory was added later by Steffen Hageland.

Initialization and program flow
First the source is scanned from left to right, top to bottom, to find the first non-whitespace character; this is the first instruction. The next instruction is then found by moving the instruction pointer (IP) to a non-whitespace character one step in any direction (north, north-east, east, south-east, south, south-west, west, north-west).

The previous instruction will never be selected as the next instruction, leaving only seven possible directions. Of the possibilities that are left, the interpreter will select the first in the clockwise direction from the direction from the previous IP position.

Given these "cells":

+--+--+--+ |             |              |              | |   Previous   |              |              | |     IP      |              |      A       | |  position   |              |              | |             |              |              | +--+--+--+ |              |              |              | |              |              |              | |              |     _IP_     |      B       | |             |              |              | |              |              |              | +--+--+--+ |              |              |              | |              |              |              | |      E       |      D       |      C       | |             |              |              | |              |              |              | +--+--+--+

..the next instruction would be A. This is only the case though if the topmost value on the stack is a number other than zero. If it is zero, the next instruction will be selected counter clockwise - E would be the next instruction.

A simple demonstration
?_1    __    x   2  | x x  3 _++__o____4 +    x +      x_5_ +        | |_+++9876_|

Here is a dump of how the instructions modify the stack (which the interpreter will output if you ask for it):

? => [   _ => [    1 => [1    x => [1 x => [1 o => [1 x => [1 2 => [1,2   _ => [1,2    _ => [1,2    | => [1,2    3 => [1,2,3    4 => [1,2,3,4    _ => [1,2,3,4    _ => [1,2,3,4    _ => [1,2,3,4    x => [1,2,3,4 x => [1,2,3,4 _ => [1,2,3,4   5 => [1,2,3,4,5    _ => [1,2,3,4,5    | => [1,2,3,4,5    | => [1,2,3,4,5    _ => [1,2,3,4,5    6 => [1,2,3,4,5,6    7 => [1,2,3,4,5,6,7    8 => [1,2,3,4,5,6,7,8    9 => [1,2,3,4,5,6,7,8,9    + => [1,2,3,4,5,6,7,17    + => [1,2,3,4,5,6,24    + => [1,2,3,4,5,30    _ => [1,2,3,4,5,30    | => [1,2,3,4,5,30    + => [1,2,3,4,35    + => [1,2,3,39    + => [1,2,42    _ => [1,2,42    + => [1,44    + => [45    _ => [45    x => [45 x => [45 1 => [45,1   _ => [45,1    ? => [45

The result is what's left on the top of the stack. The program calculates the sum of all digits from 1 to 9.

Hello, world!
This hello world program doubles as the programming language logo.

|  __+8>____-<3>____+6>__ _________________________ |  |                      |                         | |  |   __>-<3>__&&>>1__   |  _____   ____  _______  |  __ |  |  |                |  | |  __ \ / __ \|  __ \ \ | / / |  |  |                |  | | |__) | |  | | |__) \ \_/ /  |  |  |__>7<-__>3+__"  |  | |  _  /| |  | |  ___/ \   /   |  |                   |  | | | \ \| |__| | |      | |    |  |__65*2+____67*2<+__|  | |_|  \_\\____/|_|      |_|    |                         |                         | |____001&&________>8+_____|__+ - * / < > ? % ! & "__|

Project Euler problem #1
0_99872***-______  (c) Torbjorn Maro    __+___ |                      |      |    This ROPY program  |             ?? 1     <  <= REDUCE LOOP calculates the    @1____?___>!_|  |___0___|_?_<__|     MAKING SUM sum of all the       |         |                 | multiples of 3 or    0         ? ?   5 below 1000. -        >                 |                          <         3          THIS IS THE END 1        <             ______?______|         %             |                      |             |___0_>?__MOD_THREE____@__?____>5<%__ |                    |             |             |   ++    1             |             |   |            |    ?             |             |   |            |    |             |             |   ++    |___MOD_FIVE__@ |                                  |             |_______________NOT_INCLUDED________|

Reverse stack
| |   REVERSING A STACK                   ___]3[<]3___             _<3+1]3]]3__ |    USING MEMORY                      |            |           |            | |    PUT AND GET                       1   PUT      [           [            [ |                                      +   STACK    <           |   READ     < |                                      3   INTO     2           |   REVERSE  1 |___Initial_stack_1234567890__         <   MEMORY   -           |   ORDER    - |        [            <           |            <  ___Num_elements_&10__________|         1            1           1            1       STACK IS REVERSED |                                      @            @           @            @ |__>1<[2<[34[_________________________0@ @?____2]___@ @_?34[___0@ @?____1]___@ @?__________DONE_________

Interpreters
The original interpreter was implemented in Ruby, but a compatible one has also been implemented in Common Lisp.

Externam resources

 * Ropy official interpreters on Github