DOBELA
Dots of 0 and 1 fly across the grid, bounce off walls and crash into each other. The only memory is one queue of bits.
asiekierka, 2008 · Turing complete: unknown · ●●● hard · esolangs.org
Tested with 3 known programs · Hello World on Try It Online: identical · Test method
Run it
The idea
asiekierka made DOBELA in 2008, the DOt-BAsed Esoteric LAnguage, and the people of #esoteric extended it until Deewiant wrote down version 13 of the spec in 2009. A , in the source is a 0 dot and a . is a 1 dot, and every dot starts flying east, one cell per step. Everything else stands still and acts on the dots that hit it. A wall # turns a 0 clockwise and a 1 counter-clockwise, = flips a dot as it jumps over, + splits one into two, and : is a generator that keeps firing dots of its own.
Read the story
Output goes through the queue. $ swallows a dot and adds its bit to the queue, and a dot that hits ^ from below prints the whole queue as bytes, lowest bit first. So the Hello World is one long row of dots flying into $, and one more dot on the next line that hits a wall, turns up and strikes ^ just after the last of them is in.
Dots also collide. Two that meet head on die, and leave a wall behind if they were alike. The spec has rules for every kind of crash. This implementation follows stasoid's dobcon, whose own spec changes some of them to keep the interpreter simple, for instance by running all commands before any collision.
The machine
| Char | Does |
|---|---|
, . | A 0 dot and a 1 dot, flying east |
# | Wall; a 0 turns clockwise, a 1 counter-clockwise |
\| | A wall from the sides; a dot from above or below sets which way it sends dots |
= | Flip the dot, which jumps over |
: | Generator, firing its bit east; hits from above and below switch it off and change the bit |
+ | Split a dot into two going sideways |
$ | Put the dot's bit on the queue |
^ | From below print the queue, from above empty it, from the sides toggle every generator |
v | Take a bit off the queue and send it on as a dot |
_ | Read the input, one bit at a time, and drop it downwards |
The program ends when no dot is left and no input is coming.
Example
The first is the Hello! from esolangs.org, which ends with a line feed.
The first is the Hello! from esolangs.org, which ends with a line feed. The second prints Z, which is 01011010 in binary. Its lowest bit has to reach $ first, so it is the dot nearest to $, and the bits run backwards along the row.
Patterns it teaches
- Two-dimensional control flow: many dots move at once, and timing is everything.
- Encoding tricks: text is written out bit by bit, backwards.
Further
- esolangs.org/wiki/DOBELA
- dobcon, stasoid's interpreter in C, with its spec.txt
See also
Queue-based
Two-dimensional languages
Write your own in Run Convert a program from DOBELA
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: dobela-dobcon.
Command line
shib run dobela-dobcon -e ',.,..,.,$^
. #'shib manual dobela-dobconSource
- Module
langs/tio/ports.js- Interpreter
langs/tio/dobela-dobcon.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org