Cellular

From Esolang
Jump to navigation Jump to search

Cellular is a esoteric language based on two dimensional cellular automata, that works on a stream of data. It is executed on a cylindrical surface, where the top is fed with the input and the bottom represents the output. Execution finishes when the input is fully consumed. The width of the cylinder is n bits, depending on the size of the input and the output.

The user can supply input, rules and an initial program to the interpreter. Program here means placements of the cells on the cylinder.

The program and input are processed as classical game of life or as a CA with a different rule set. Every step output is read from the bottom of the cylinder and given back to the user.

Instructions

Instructions
Prefix Payload Size Description
r rule set as bits 9 bits Multiple rules can be given
p program as bits n bits The initial program, multiple lines can be given
s input stream n bits The input, multiple inputs can be given

Example program

Not very useful, but it gives an example.

   r:000100000
   r:001100000
   p:00000000
   p:00001010
   p:00101000
   s:11100111
   s:11100111
   s:11100111
   s:11100111
   s:11100111

This creates a streaming processor that processes 8 bits of data. p sets up the initial playing field. The first r is the ruleset for cells in state 0, aka dead. They will transition to state alive if they have 3 neighbors. The second r is for cells with state 1. 2 and 3 neighbors keep them alive.

And finally an s is send every step to the top in the order given, above the first program line.

Implementation