Zucchini
Every part of a program is a node that fires signals at other nodes once its level is high enough.
2013 · Turing complete: unknown · ●●● hard · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
Zucchini is a network of nodes. Each node has a threshold, a level and a list of targets with the signal it sends each one. On every tick, each node at or above its threshold fires, and then every level becomes the sum of what that node received. Stdout, stderr and exit are three more nodes past the end of the program.
Read the story
There are no instructions and no memory but the levels. A clock is a node that fires at itself; a one-shot is a node that sends itself -1 and so never fires again.
The machine
Nodes are separated by / and numbered from 0. A node is its threshold followed by its targets, each a node number and a signal. Numbers are in base 4.
| Symbols | Mean |
|---|---|
space . ` : | Digits 0 to 3 | |
space , ' ; | Digits 0 to -3, in a negative number |
= | Zero |
- | A byte of input, -1 at the end |
+ | The sending node's own level |
With n nodes, node n is stdout, n + 1 stderr and n + 2 exit. What reaches stdout in a tick is written as a byte, and the program ends when exit's level is above 0.
Example
The Hello World.
The Hello World. Node 0 fires once and starts a chain. Each node in the chain sends one character to stdout, node 17, and fires the next. The first signal is a dot, a space, a backtick and a space, so 1, 0, 2, 0 in base 4, which is 72, an H.
The cat has a clock, a node that reads a byte with - and passes it on, and a check that fires the exit when the byte is -1.
Patterns it teaches
- Encoding tricks: numbers in base 4 written with dots and quotes.
Further
See also
Also in Strange time
Write your own in Run Convert a program from Zucchini
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: zucchini.
Command line
shib run zucchini -e '=0,1.12./.2.7./.3.6-/.4./.5./.1./.9,10.11+/.6.8./.9./.15./.13,/.13+/.12.0,' --input 'Hi!'shib manual zucchiniSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/zucchini.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org