котята-арбузята
Two halves that cannot compute alone. One reads and never prints, the other prints and never reads, and they pass numbers back and forth.
Dragoneater67, 2026 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
Dragoneater67 made котята-арбузята in 2026 to see whether systems that are not Turing complete can form one that is by talking to each other. In Russian котята are kittens, and арбузята puts the same ending on арбуз, watermelon.
Read the story
A program is two programs in two small languages. котята reads input and writes to a shared deque of bytes, but it cannot print. арбузята takes bytes from the deque and prints them, but it cannot read input. Neither has a loop or a jump. They run side by side, one command each in turn, and send each other signals. A signal is a byte that starts the other side's handler for it. A handler that signals back, so that the other handler signals again, is the only way to repeat anything.
Neither half is Turing complete on its own. The specification links a proof that the pair is.
The machine
The specification gives a program as two files, .ктя for котята and .абя for арбузята. Both go in one text, as in the specification's one-file mode, with a line holding + between them. Every value is a byte from 0 to 255.
котята reads input and writes the deque.
| Command | Does |
|---|---|
( v | Push v to the front of the deque; ( | pushes a character of input |
! v | Push v to the back; ! \ pushes a character of input |
' v | Send signal v to арбузята; ' & sends a character of input |
} v [ code ] | Set the handler for signal v |
. | Halt |
арбузята reads the deque and writes output.
| Command | Does |
|---|---|
: v | Print the byte v; : # pops the front of the deque and prints it, : * the back |
^ v | Send signal v to котята; ^ % sends a byte popped from the front, ^ ? one from the back |
< v [ code ] | Set the handler for signal v |
, | Halt |
Popping an empty deque does nothing, and so does a signal with no handler. A side that runs out of commands waits for signals, and the program halts once both sides have halted. Text between backticks is a comment.
The specification leaves the timing open. This implementation lets котята move first. In its turn a side starts the handlers for the signals it got since its last turn, and then its main program and every running handler do one command each. Reading past the end of the input does nothing. When neither side has anything left to do and they have not both halted, the program would wait forever, and the run stops there.
Example
The XKCD random number.
The XKCD random number. котята halts at once. арбузята prints the bytes 52 and 10, which are 4 and a line feed, and halts.
The truth machine. котята reads a character and sends it to арбузята as a signal. On 0, which is byte 48, арбузята prints 0, signals 0 back and halts, and котята's handler for 0 halts it as well. On 1 the handlers for 49 and for 1 call each other forever, and every round prints another 1.
The cat is the same ping pong. котята's handler pushes a character of input to the front of the deque and signals арбузята, whose handler prints a byte from the back and signals again. It does not halt at the end of the input, as the specification says.
Patterns it teaches
- Turing completeness: two halves that are not Turing complete make one that is, by passing signals.
See also
Deque-based
Concurrent programming
Write your own in Run Convert a program from котята-арбузята
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: u41a-43e-442-44f-442-430-2d-430-440-431-443-437-44f-442-430.
Command line
shib run u41a-43e-442-44f-442-430-2d-430-440-431-443-437-44f-442-430 -e '.
+
: 52
: 10
,
'shib manual u41a-43e-442-44f-442-430-2d-430-440-431-443-437-44f-442-430Source
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/u41a-43e-442-44f-442-430-2d-430-440-431-443-437-44f-442-430.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org