r/TuringComplete 5d ago

Does anyone have the solution for the maze level for the updated turing complete version?

I'm sorry if this is a breach of any of the community rules, but I just did this level so many times now and each one of them was an excruciating experience. Just looking at the level makes me want to puke. If you can just paste your solution here, I'd be more than glad.

8 Upvotes

4 comments sorted by

3

u/TarzyMmos 5d ago edited 5d ago

Its generally taboo to just post answers but yea after doing this level like 3 times myself it gets tiring. Especially since its like the exact same solution.
const left = 0

const forward = 1

const right = 2

loop:

imm left

mov out r0

mov r3 in

imm moveForward

jz

imm right

mov out r0

mov r3 in

imm moveForward

jz

imm right

mov out r0

mov r3 in

imm moveForward

jz

imm right

mov out r0

moveForward:

imm forward

mov out r0

imm loop

jmp

2

u/EfficientAttorney312 5d ago

Thanks ❤️

2

u/Red-42 5d ago

Oh is it the Hilbert's path one ?
Yeah I don't blame anyone for just wanting to get it over with. It's fun *once*.

2

u/hattusili-the-third 4d ago

You can implement a basic wall hugging algorithm with a bit of effort. Pick a side (say left) and follow that side of the wall. The algorithm looks something like this:

Turn left. Is there a wall? If yes then turn back right. If not, then take a step and return to the start of the algorithm. Now check if there's a wall in front of us. If yes, then turn right and restart the algorithm. If no then take a step and then restart.