Chickenfoot

From Esolang
Jump to navigation Jump to search
Chickenfoot
Paradigm(s) imperative
Designed by User:Ttulka
Appeared in 2023
Memory system Cell-based
Dimensions two-dimensional
Computational class Turing complete
Major implementations Interpreter in JavaScript
Influenced by Minsky machine
Influenced None
File extension(s) .ЁЯРФ

Chickenfoot is a two-dimensional programming language inspired by a chicken tap dance with dominos, where the chaotic rhythms of the moonlit barnyard translate into code and feathers.

How it works

The program is equipped with four registers further referenced as r0, r1, r2, and r3. Each register holds an unbounded integer value.

The execution starts at the begin command and continues left-to-right as the default. The flow can be altered by the conditional branching command or by a handful of flow commands. In this way, loops can be created.

The program halts when a whitespace is read.

Commands

Each command consists of a single symbol of the Braille 6-dot patterns:

  1 2
A o o
B o o
C o o

Braille symbols that do not fit any command definition and all other symbols are interpreted as whitespaces.

The begin command та┐ indicates the beginning of the program. Each program must include exactly one begin command:

та┐

Except for the begin command, dots in the second column indicate the operation:

Rows Operation Precedence Examples
A Increment 1 таП, таЛ
C Decrement 1 таз, таж
B Conditional branching 2 таЯ, та╖
A+C Flow 3 та╜, тал

Operations conditional branching and flow combine other dots as additional parameters.

For arithmetic commands increment, decrement, and the control flow command conditional branching, the number of dots in the first column indicates the index of a register to work with:

Number of dots Register Examples
0 r0 таИ, таШ
1 r1 таЙ, таЬ
2 r2 таЛ, таЭ
3 r3 таП, таЯ

The vertical position of dots in the column is irrelevant and fully aesthetics-driven. The following commands are equivalent: таЛ, таН, таО.

Increment

The increment command increases the value of the selected register.

Increment r2 two times:

та┐таНтаЛ

Decrement

The decrement command decreases the value of the selected register if its current value is greater than zero.

Decrement r1 two times after incrementing it three times:

та┐таЙтаЙтаЙтабтав

Conditional branching

Conditional branching changes the control flow based on the current value of the selected register. If the value equals zero, the flow branches; otherwise, it continues left-to-right.

The command always comes with another dot in the second row, which indicates the direction of the control flow in the case when the value of the selected register is equal to zero:

Rows Zero flow direction Examples
B+A Northeast таЯ, таЩ
B+C Southeast та╖, та▒

Set r3 to one if r2 is greater than three:

та┐тагтагтагта│таП

Flow

The flow operation changes the control flow of the program.

The number of dots in the first column indicates the direction:

Command Flow direction
тай North
та╣ Northeast
та╜ East
та╝ Southeast
там South
тао Southwest
тап West
тал Northwest

A flow into the chicken hole:

та┐та╜та╜та╜та╜та╝
 тал     там
 тай     тао
  талтаптаптап

Examples

(As various editors may not consistently display Braille symbols at the same size, Cascadia Code is the recommended font for Chickenfoot.)

No-op program

The simplest valid program:

та┐

Infinite loop

The smallest chicken hole:

та┐тап

Truth-machine

If r0 contains 1, it sets r1 to 1:

 та┐та░таК

Copier

It copies content of r0 to r1:

  таотаптаптап
та┐та░таКтаНтаатай
  та╝ таотаптап
   та╡таИтагтай

Fibonacci sequence

It takes an index in r0 and computes the corresponding Fibonacci number in r2:

        тао
       тао тал
та┐та░таЛтаатаШтаата│тагтаМтаПтал
     тал та╝
      тал та╝ таотап
       тал та▓тавтаОтал
        тал та╝
         тал та╝ таотап
          тал та╖тазтаМтал
           талтаптап

Addition of two numbers

It adds values in r0 and r1 to r2:

       тао       тао
      тао тал     тао тал
     та╖таИтазтай    та╖таМтазтай
    та╣ та╝     та╣
   та╣   та╝   та╣
  та╣     та╝ та╣
та┐таШтаЛтаПтаатам   таЪтаЛтаПтавтам
  тал  тао    тал  тао
   талтап      талтап

Turing completeness

Chickenfoot is evidently Turing-complete as any Minsky machine can be translated into Chickenfoot:

Minsky machine Chickenfoot
INC таИ
JZDEC таШтаа

Four unbounded registers are also sufficient as a Minsky machine has been demonstrated to be Turing equivalent using only two registers (or even a single one when G├╢del numbering is employed).

External resources