esolang

1cnis

A list where every element is replaced at once, and each element carries one counter.

ais523, 2007 · Turing complete: no · ●●○ moderate · esolangs.org

Tested with 3 known programs · Test method

Run it

Expected: 0 01 0110 01101001

The idea

ais523 made 1cnis in 2007 and made it Turing-incomplete on purpose. The name stands for single-counter neighbour-independent substitution system. Its job is to write infinite starting conditions for other machines, such as Turing machines, without smuggling a computation in with them.

Read the story

A program is a list of elements and a rule for each kind of element. Every step replaces each element by its rule, all at the same time and without looking at its neighbours. After every step the list is printed through a translation table, so the output is a string and not the list.

The machine

An element is letters and then a counter, as in x0 or v3. A rule sees the letters and only whether the counter is 0 or not, written 0 and ?. It gives the replacement elements, each with its counter as + (one more), = (the same) or - (one less).

SectionHolds
[initial]The list, on one line
[rules]Lines such as x? > x- v- v-
[translation]Lines such as o > 1; the text may be empty

The reference in Perl prints the first output and then waits. Each empty line it reads makes one more step and prints it, and anything else ends the run. The input works the same way.

Example

A self-embedding program grows the Thue-Morse sequence.

A self-embedding program grows the Thue-Morse sequence. Each output starts with the one before it.

A counting program uses the counters. After k steps it prints k + 1 blocks of k + 1 ones, with a 0 between blocks.

Expected: 1 11011 11101110111

Patterns it teaches

  • String rewriting: every element is rewritten in parallel, and a counter is the only memory an element has.

Further

String-rewriting paradigm

Write your own in Run Convert a program from 1cnis

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: 1cnis.

Command line

shib run 1cnis -e '[initial]
x0
[rules]
x0 > x= y=
y0 > y= x=
[translation]
x > 0
y > 1
' --input '




'
shib manual 1cnis

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/1cnis.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org