Tablebase

From Esolang
Jump to navigation Jump to search

Tablebase (the kind not related in any way or manner to chess.) is an Esolang (ok that kind) that has a weird way for documenting its commands: There are 49 of them, even though half do nothing and consist of a number 1-7 and a letter A-G. Fusing them in certain combos makes real commands; others are NOPs.

Table of conte- I mean commands

oh god, this is the biggest table I've ever tried to use.

Coordinate plane
x 1 2 3 4 5 6 7
A Access the table cell defined by the next coord and have it as a value. Output the table cell defined by the next coord as ASCII character. Do the controlled part the amount of times first specified by that coord on table NOP Pause execution until any input given Do controlled part if the next coord on var table isn't equal to 0 Start control
B Return an error for no particular reason Output the table cell defined by the next coord as number. Do controlled part while the next coord on var table isn't equal to 0 End comment Start comment Print source code End control
C Get input and store in table cell defined by next coord as number Cube the next given coord NOP NOP Modulo the next two coords (first coord % second one) NOP End program regardless of where it is.
D Wait 1 second Clear output Get input and store in table cell defined by next coord as ASCII code Square the next given coord NOP Store a string of characters in the next coord specified Dont print Newline next print command
E Add next two coords Set the next coord to zero Integer divide next two coords (always round DOWN, first one - second one) Set the next coord value to infinity somehow NOP NOP Export output as a file somehow
F Subtract next two coords (First one - second one), place Multiply next two coords NOP Open the calculator Supply a random number between the next two given coords. Delete program after execution Wait a random interval for throttling
G Reset every coord Set the next coord's value to the value of the coord after that Do next command 3 more times Find the first occasion the next given value appears in coord and output that coord. Do next command on 50% of occasions Return meaningless stats about the interpreter Set the next coord's value to a given number in decimal.

Every time it ever refers to "coord" it means something like this:

X 1 2 ...
A
.
.
Z

Where a coord is just a place in that field, which holds a single integer. And when any arithmetic is done, the result is placed in the first set of coords.

Tablebase programs

Cat program

D3 H5 B3 H5 A7 A2 H5 D3 H5 B7 C7 B5 Translated to brainfuck as ,[.,] B4

Quine

B6 C7

Truth Machine

C1 H1 B3 H1 A7 G7 H2 49 D7 A2 H2 B7 G7 H2 48 A2 H2 C7

Looping Counter

G7 H1 1
G7 I1 1
G7 X1 1
G7 P1 69
B5 Repeat until P1 = 0. B4
B3 P1
A7
  B5 Repeat until H1 = 0. B4
  B3 H1
  A7
    B5 Set: P2 = 42. B4
    G7 P2 42
    B5 Print P2, that is, '*'. B4
    A2 P2
    B5 Subtract: H1 = H1 - I1 = H1 - 1. B4
    F1 H1 I1
  B7
  B5 Add: X1 = X1 + I1 = X1 + 1. B4
  E1 X1 I1
  B5 Set: H1 = memory[X1]. B4
  G2 H1 X1
B7

Fibonacci Sequence Printer

The following program queries the user for the number of Fibonacci numbers to generate, produces and prints them.

B5 Set F0 = 0. B4
G7 H1 0
B5 Set F1 = 1. B4
G7 H2 1

B5 Set N to user input. B4
C1 H4

B5 Use H5 as a subtrahend for printing F0 and/or F1 if N > 0. B4
G7 H5 1
B5 If N >= 1, print F0. B4
A6 H4
A7
  B5 Print F0. B4
  B2 H1
  F1 H4 H5
B7

B5 If N >= 2, print F1. B4
A6 H4
A7
  B5 Print F1. B4
  B2 H2
  F1 H4 H5
B7

A3 H4
A7
  B5 Set F2 = F0 for coming addition. B4
  G2 H3 H1
  
  B5 Set F2 = F0 + F1. B4
  E1 H3 H2
  
  B5 Print F2. B4
  B2 H3
  
  B5 Set F0 = F1. B4
  G2 H1 H2
  B5 Set F1 = F2. B4
  G2 H2 H3
  
  B5
    Set F2 = 0 for demonstrating purposes. This step can actually
    be neglected.
  B4
  E2 H3
B7

Interpreter

  • Common Lisp implementation of the Tablebase programming language.