What a great game. I just wanted to share some of the cooler stuff I built for the main campaign.
- Non-recursive
- Using relative coordinate systems for each depth
- Establishing quadrants in these using divmod 4
- Establishing movement vector based on smallest (relevant) quadrant
- Rotating vector as necessary to pop from relative to absolute coordinates
- Saving bytes by:
- using infinite recursion to emulate
forwith the stack pointer - employing modular arithmetic to reduce conditionals
- merging multiple loops into one using an "unnatural" initial value as indicator
- using infinite recursion to emulate
#include "leg.lml"
const _ 0
const li i1|i2|add
const uj i1|i2|j
const ucall i1|i2|call
#########################
const step sp
const quad b
const shift c
const dir d
# initial dir - any "unnatural" value
const dir_init 100
label hilbert_loop
li _ 1 shift
li _ dir_init dir
label loop
div step shift quad
i2|mod quad 4 quad
i2|j|neq dir dir_init rotate
i2|j|eq quad 3 nodir
# base dir found
i2|add quad 3 dir
label nodir
uj _ _ loopend
label rotate
# rotate dir
i1|j|ult 0 quad noflip0
i1|sub 3 dir dir
label noflip0
i2|j|ult quad 3 noflip3
i1|sub 1 dir dir
label noflip3
label loopend
i2|mul shift 4 shift
i2|j|neq shift 1*4*4*4 loop
i2|mod dir 4 io
ucall _ _ hilbert_loop- An implementation of the algorithm above in wires
- Performing long division
- Establishing move entirely from move number
n - Disk size <-
count_traling_zeroes(n) - Peg pair <-
n % 3 - Move direction <-
disk_size % 2
I know a 2-gate solution exists, but this still seems cool...
It also corresponds to mere 16 bytes of OVERTURE assembly.
# import robot.oml
const left 0
const step 1
const right 2
const chill 3
const actn 4
const pew 5
#########################
# quick actions
const now mov | fa | out
const observe mov | in | td
step # cache ->c
mov | fa | tc
const step_now mov | fc | out
right # cache ->e
mov | fa | te
const right_now mov | fe | out
actn # cache ->f
mov | fa | tf
const actn_now mov | ff | out
label go
step_now
left now
left now
label search
right_now
observe
go j_z
actn_now
search j- 562/110
- 2342/1398
- Everything is a register
- Conditional calls
- Read-write-able stack pointer





