Cool Cell
30,000 byte cells and jumps to labels, but no way to print a cell. It prints only what is written in the program.
ChuckEsoteric08 · Turing complete: with unbounded memory · ●○○ easy · esolangs.org
Tested with 4 known programs · Test method
Run it
The idea
ChuckEsoteric08 made Cool Cell as a Turing machine that would compile to Quests. It turned into brainfuck with a fixed memory. A program is a row of commands split by ;, each one a letter with its argument written right after it.
Read the story
The only output commands, t and h, print their own argument. So a program reads a number, puts its digits in cells, tests the cells and picks which text to print.
The machine
There are 30,000 cells of one byte, counted from 1. The pointer starts at cell 1.
| Command | Does |
|---|---|
sX | Point at cell X |
rX | Point at the cell whose number cell X holds |
iX dX | Add X to the cell, or take X from it |
pX | Write each digit of the input number into the cells from X on |
aX | Declare the label X |
gX | Jump to label X |
zX oX | Jump to X if the cell is 0, or if it is not |
fDtX | Jump to X if the cell holds the digit D |
tX | Print X |
hX | Print X and halt |
# | A comment |
A cell does not wrap one step at a time. The whole change is made first, and a result above 255 becomes 0 while a result below 0 becomes 255. So i288 leaves 0, not 32, and d123 leaves 255.
Example
The truth machine writes the first digit of the input into cell 1.
The truth machine writes the first digit of the input into cell 1. On 1 it jumps to loop and prints 1 forever. On 0 it goes on to h0, which prints 0 and halts. The second version tests the digit first and prints Error! for anything but 0 or 1.
d123 sets the cell to 255 and i1 takes it past 255, so it becomes 0 and z0 jumps.
See also
Cell-based
Write your own in Run Convert a program from Cool Cell
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: cool-cell.
Command line
shib run cool-cell -e 'tHello, World!;'shib manual cool-cellSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/cool-cell.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org