Skip to content

“TIS-100” – SELF-TEST DIAGNOSTIC (SEGMENT 00150)

TIS-100 index

This puzzle is just a tutorial for passing values between execution nodes, so instead here’s my solution for the BUSY_LOOP achievement for taking more than 100,000 cycles for your program to finish:

full solution

The full code of the busy loop is in the three units in the left column:

main code segment

Instead of passing the value directly, they perform an “algorithm” where the upper unit reads in the value and holds it hostage until the unit below it guesses it correctly by sending up a value. Naturally, the best way we should do this is for the middle unit to first guess 0, then 1, then 2, and so on, so we’ve taken this nice circuit that should just pass a value through it and turned it into something whose run time depends on the size of the value, which is fun.

But if the middle unit just sends up those numbers directly, that’s not nearly slow enough. What would help add another extra level of pain here would be if, after guessing incorrectly, its counter gets reset back to 0 and it has to count all the way back up to the next guess. This is basically set up like another guessing game, except with the bottom unit; it starts at 0 and asks if that’s the number it should send up, then 1, then 2, and so on. Once it finds that number, the bottom unit increases its stored number by 1 for the next guess.

When the middle unit finally guesses the number correctly, it sends a special signal 999 down to the bottom unit, which causes its accumulator to go negative (which is how it knows to output the number that was last guessed). Theoretically, if one of the inputs is 999, the program would break because 999 – 999 isn’t negative, but luckily the input range for this puzzle seems to be capped at 99.

This runs in 804,029 cycles, easily breaking the 100,000 needed for the achievement. It’s possible to crank it up further by making the middle unit start lower than 0 (START: MOV 0, ACC) when it counts up. I really don’t intend to ever try starting at -999.