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.

Checkers

From Esolang
Jump to navigation Jump to search

Checkers is a very simple pattern-based esolang created by User:ChuckEsoteric08.

Description

Checkers uses a queue of unbounded integers (whether signed or unsinged depends on the implementation) as data, which initially starts with three zeroes. Each instruction consists of three symbols some of which are repeated twice and others once. What characters are used, however, is not defined. Here they are represented as a, b and c

Instructions
Amount of as Amount of bs Amount of cs Queue Description
1 1 1 [ a ... ] > [ ... a ] Dequeue an element and enqueue it.
2 1 1 [ a ... ] > [ ... a a ] Dequeue an element and enqueue it twice.
1 2 1 [ a b ... ] > [ ... b a ] Dequeue an element, call it a, and then another, call it b, then enqueue element b followed by a.
1 1 2 [ a b ... ] > [ ... a+b ] Dequeue two elements, add them, and enqueue the result.
1 2 2 [ a b ... ] > [ ... a-b ] Dequeue two elements, subtract then, and enqueue the result.
2 2 1 [ a ... ] > [ ... a=0 ] Dequeue an element, if it is zero enqueue 1, else enqueue 0.

Other patterns are invalid. Program runs in an infinite loop.

Computational class

It is Turing-complete as it can simulate two-register Minsky machine. First we need to translate it into this language:

INC x y - Increment x and move y commands forward
DEC x y - Decrement x and move y commands forward
IF x - If x is zero skip next instruction

Which also runs in an infinite loop, and when instruction pointer moves past the end of a program it is moved to the start.

It is possible to translate it into Checkers. Assume initial queue is represented as:

A B C

In which C is a distance between current command and next. Then each command is translated:

  • INC A y would be translated into a series of instructions so that queue would become:
A+(C=0) B C+y*(C=0)-1
  • DEC A y would be translated into a series of instructions so that queue would become:
A-(C=0) B C+y*(C=0)-1
  • INC B y would be translated into a series of instructions so that queue would become:
A B+(C=0) C+y*(C=0)-1
  • DEC B y would be translated into a series of instructions so that queue would become:
A B-(C=0) C+y*(C=0)-1
  • IF A would be translated into a series of instrucitons so that queue would become:
A B C+(A=0)+(C=0)-(C!=0)-1
  • IF B would be translated into a series of instrucitons so that queue would become:
A B C+(B=0)+(C=0)-(C!=0)-1

See also