We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Tetrahedron

From Esolang
Jump to navigation Jump to search

Tetrahedron, with hexagony as its inspiration, is a fungeoid created by user:cleverxia that operates on a finite tetrahedron.

Program flow

first, the program is loaded into "program tetrahedron" from top to bottom, up to down, left to write, truncated so that there aren't any all-null layers. for example,

123456789abcdefghijklmnopq

will result in this tetrahedron ($'s are nulls):

    1

   2 3
    4

  5 6 7
   8 9
    a

 b c d e
  f g h
   i j
    k

l m n o p
 q $ $ $
  $ $ $
   $ $
    $

IP starts at the top corner, heading down-west (DW).

 UN
UW UE

 NW NE
W IP  E
 SW SE

DW DE
 DS

when the IP/DP overflows at the DW direction it wraps to the top keeping the same direction. same for DE,DS,UN,UW,UE. when IP overflows at the E direction, it "warps and reflects to the other side" like this:

   $             Z
  3 6           9 5
 0 X 2         $ $ 6
$ 8 5 $       0 1 2 Y

where numbers represent the time that the IP comes there, X contains 1/4/7, Y contains 3/7, Z contains 4/8. essentially the same for W/NW/NE/SW/SE.

The data pointer starts at the top, heading down-west (again).

Before the program starts, all commands in the tetrahedron is changed into the corresponding opcode in numbers with null ($)=0. (Otherwise there are no way for you to manage the data) DP's value is the opcode of the cell pointed by the data pointer

Commands

division/modulo by zero results in 0

Caption text
command opcode meaning
-1 APLWSI interpreter
0~9 0~9 also APLWSI interpreters, useful for initializing data
△▽○◇□☆▲▼●◆■★ -2~-13 go in the specified direction
opcode direction
-2 UN
-3 UW
-4 UE
-5 NW
-6 NE
-7 W
-8 E
-9 SW
-10 SE
-11 DS
-12 DW
-13 DE
▷◁♤♡♢♧▶◀♠♥♦♣ -14~-25 set data pointer direction in the direction specified by the table above and opcode (x+12)
Δ -26 set the IP's delta to the DP's value
δ -27 set DP's delta to DP's value
@ 10 halt
" 11 move the DP in its direction by delta
# 12 skip next instruction
$ 13 swap current DP's value with register. (register starts at 0)
+-*/%∧∨⊕⊙ 14~18 , 28~31 DP's value [command]= register (integer division, rounds towards zero)
> 19 right shift current cell by 1 bit
o 20 output DP value as ASCII
n 22 output DP value as number
i 21 input ASCII to DP value
j 23 input number to DP value
_ 24 reflect
¤ 25 load a schematic with ID equal to DP value
ʃ♭♯♮А-Яа-я❶❷❸❹❺❻❼❽❾❿º¹²³½¼¾⅓⅔₁₂₃∞†‡ 32~126 schematic command, undefined commands interpret APLWSI (also can be used as initializers)
α
β
γ
ε
ζ
η
θ
ι
κ
λ
μ
ν
ξ
ο
π
ρ
σ
τ
υ
φ
χ
ψ
ω
Γ
Θ
Λ
Ξ
Π
Σ
Υ
Φ
Ψ
Ω
Þ
Š
Œ

™
®
©
¤
ʌ
Ð
Ç
Æ
127
128
150
200
250
300
400
500
600
700
800
900
1000
1024
512
256
243
729
2187
6561
2048
4096
8192
16384
32768
65536
625
3125
15625
4294967296
264
123456789
1234567890
81985529216486900
3141592653589793
1000000000000000
2718281828459045
1414213562373095
1732050807568877
2236067977499789
1618033988749895
144
441
114514
1919810
moar initializers
! 26 logical not DP's value
b 27 branch: if DP's value is <=0, then turn left 60 degrees, otherwise turn right 60 degrees

Examples

Truth machine (hopefully)

00??0?????0?????????▲j0▼?●☆b?n◇▼□n@

? can be replaced with anything