Rotpai

From Esolang
Jump to navigation Jump to search

Rotpai is an esoteric programming language made by User:Mipinggfxgbtftybfhfyhfn.

Syntax and execution

A Rotpai program is a list of ordered pairs of characters:

ah ba bd fg

Each line of the program is independent of every other line unless the last character of the last pair in it is ., then the line with this property and the next line are considered to be just one line:

a.
bc

is the same as:

a. bc

At each step of the program, to generate the next state, the interpreter goes through this process for each pair:

  1. If the pair doesn't match in any of its ends to the adjacent pairs, it is rotated (ab ca cd => ab ac cd)
  2. If the pair matches in one of its ends, it is swapped with the pair at the end (ab ac cd => ab cd ac)
  3. If the pair matches on both of its ends, do nothing to it (ab bc cd => ab bc cd)

An end touching the edge is considered to always match.
The program halts when none of the pairs can be rotated.

Computational Class

Rotpai's computational class is unclear, but it is most likely a finite state automaton.

Examples

Simple Rearrangement

The program

ab cb cd

requires a single cycle for its patration's accomplishment, limning the following trajectory:

ab cb cd
ab bc cd

Line Continuation

This program

a. b.
d. .e

perambulates across the evolutions

a. b. d. .e
a. .b .e d.
.b .e a. d.
.b e. .a d.

until no internal rotation may be applied anymore.

Interpreter

  • Common Lisp implementation of the Rotpai programming language.