We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

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