Tablebase
Every command is a cell of a 7 by 7 table. Half of them do nothing, and one opens the calculator.
2022 · Turing complete: unknown · ●●○ moderate · esolangs.org
Tested with 4 known programs · Test method
Run it
The idea
Tablebase, from 2022, names its commands by their place in a table, a letter from A to G and a number from 1 to 7. G7 sets a cell, A2 prints a character, C7 ends the program. Many cells are no-ops, and some ask for things a program cannot do, such as opening the calculator or returning meaningless stats about the interpreter.
Read the story
The data is a second table. Its cells are named the same way, a capital and a number such as H1, and each holds a whole number. Arithmetic puts its result in the first cell it names.
The machine
| Command | Does |
|---|---|
G7 a n | Set cell a to the number n |
G2 a b | Copy b into a |
E1 F1 F2 E3 C5 a b | a plus, minus, times, divided by, mod b, into a |
C2 a D4 a E2 a | Cube a, square a, set a to 0 |
C1 a D3 a | Read a number or a character code into a |
A2 a B2 a | Print a as a character or as a number, then a line feed |
D7 | No line feed after the next print |
B6 | Print the program |
A7 ... B7 | A group of commands |
A3 a A6 a B3 a | Run the next group a times, if a is not 0, while a is not 0 |
B5 ... B4 | A comment |
C7 | End the program |
This implementation leaves out nine commands that the specification leaves vague or random, among them a random number, storing a string, infinity and opening the calculator. A program that uses one does not run. Waiting and pausing for input do nothing.
Example
The first is a quine.
The first is a quine. The second is a truth machine. On 1 it sets H2 to 49 and prints it with D7 before it, so the 1s stay on one line forever. The third is a cat, which the specification writes as ,[.,] in brainfuck. Each character comes out on a line of its own, as a print without D7 ends the line.
Patterns it teaches
- Counter machines: cells of whole numbers, arithmetic and a loop while a cell is not 0.
Further
See also
Also in Jokes
Write your own in Run Convert a program from Tablebase
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: tablebase.
Command line
shib run tablebase -e 'B6 C7'shib manual tablebaseSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/tablebase.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org