New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

chickenfoot

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chickenfoot

Chickenfoot 2D programming language

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Chickenfoot

🐔 Chickenfoot is a two-dimensional programming language for chickens.

Inspired by a chicken tap dance with dominos:

           ⠮       ⠮
          ⠮ ⠫     ⠮ ⠫
         ⠷⠈⠧⠩    ⠷⠌⠧⠩
        ⠹ ⠼     ⠹
       ⠹   ⠼   ⠹
      ⠹     ⠼ ⠹
 ⠿⠽⠽⠽⠘⠋⠏⠠⠬   ⠚⠋⠏⠢⠬
      ⠫  ⠮    ⠫  ⠮
       ⠫⠯      ⠫⠯

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 the begin command, dots in the second column indicates the operation:

ColRowsOperationPrecedenceExamples
2AIncrement1,
2CDecrement1,
2BConditional branching2,
2A+CFlow3,

Operations conditional branching and flow combinate another 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:

ColNumber of dotsRegister indexExamples
10r0,
11r1,
12r2,
13r3,

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

Increment

The increment command increments the value of the selected register.

An example of incrementing the register r2 two times:

⠿⠍⠋

Decrement

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

An example of decrementing the register 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:

RowsZero flow directionExamples
B+ANortheast (↗),
B+CSoutheast (↘),

An example of setting 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:

CommandFlow direction
North (↑)
Northeast (↗)
East (→)
Southeast (↘)
South (↓)
Southwest (↙)
West (←)
Northwest (↖)

A flow into the chicken hole:

⠿⠽⠽⠽⠽⠼
 ⠫     ⠬
 ⠩     ⠮
  ⠫⠯⠯⠯

Examples

No-op program

The simplest valid program:

Infinite loop

Don't try this at home!

⠿⠯

Truth-machine

If r0 contains 1, the program sets r1 to 1:

⠿⠰⠊

Copier

The program copies content of r0 to r1:

  ⠮⠯⠯⠯
⠿⠰⠊⠍⠠⠩
  ⠼ ⠮⠯⠯
   ⠵⠈⠣⠩

Fibonacci sequence

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

        ⠮
       ⠮ ⠫
⠿⠰⠋⠠⠘⠠⠳⠣⠌⠏⠫
     ⠫ ⠼
      ⠫ ⠼ ⠮⠯
       ⠫ ⠲⠢⠎⠫
        ⠫ ⠼
         ⠫ ⠼ ⠮⠯
          ⠫ ⠷⠧⠌⠫
           ⠫⠯⠯

Addition of two numbers

An alternative version of a program which add values in r0 and r1 to r2:

             ⠟⠉⠧⠬
            ⠹   ⠮
           ⠹ ⠫⠯⠯
          ⠹
         ⠚⠋⠏⠢⠬
        ⠹    ⠮
       ⠹ ⠫⠯⠯⠯
      ⠹
     ⠟⠈⠧⠬
    ⠹   ⠮
   ⠹ ⠫⠯⠯
  ⠹
⠿⠘⠎⠏⠠⠬
  ⠫  ⠮
   ⠫⠯

Try it

This repository contains a JavaScript interpreter for Chickenfoot.

npm i chickenfoot

It takes source code as the first argument and optionally initial register values:

const chickenfoot = require('chickenfoot')

// interpreter
const output = chickenfoot(`
         ⠮       ⠮
        ⠮ ⠫     ⠮ ⠫
       ⠷⠈⠧⠩    ⠷⠌⠧⠩
      ⠹ ⠼     ⠹
     ⠹   ⠼   ⠹
    ⠹     ⠼ ⠹
  ⠿⠘⠋⠏⠠⠬   ⠚⠋⠏⠢⠬
    ⠫  ⠮    ⠫  ⠮
     ⠫⠯      ⠫⠯
  `,
  2, 3)  // x=2, y=3

output[0] // 2 (x)
output[1] // 3 (y)
output[2] // 5 (result)
output[3] // 0

Development

Cascadia Code is the recommended code editor font for Chickenfoot.

Testing

npm test

License

MIT

Keywords

FAQs

Package last updated on 09 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc