2Swap

From Esolang
Jump to navigation Jump to search

2Swap is an esolang by VilgotanL with only two instructions and two unbounded registers, it is based on a two-register Minsky machine.

Instructions

* Swap the current register with the other register and increment the current one after the swap
-<n> Decrement the current register unless it is already zero in which jump to the start of the line <n> with line numbers starting at one, <n> can be omitted but if the register happens to be zero when <n> is omitted, the behaviour is undefined.

Any other characters are ignored.

Examples

Increment the second register indefinitely

**-
-1

Computational class

2Swap is Turing-complete since a two register Minsky machine can quite easily be translated to 2Swap, Minsky machines with two or more registers have been shown to be Turing-complete.

For example, incrementing the first register: *-*, incrementing the second register: **-

Implementations

Python implementation by the creator