Paul Plays TIS-100 21 (Sequence Sorter)

preview_player
Показать описание
Paul Plays TIS-100 Episode 21

TIS-100 is a programming puzzle game by Zachtronics.
Рекомендации по теме
Комментарии
Автор

After trying a few things I got an insertion sort working, pretty nice and easy to understand once it is done, but it took some time to get the details right.
Here are a few small hints on how to do it:
* Keep a 0 at the end of the stacks when they hold any data
* Bottom stack is always correctly sorted (but with 0 at the bottom of it)
* Easiest to make the unit above the bottom stack do the insertion loop
* If we have another input number in the sequence, move the current bottom stack to upper stack and move input number to acc. Now we loop
**  Compare acc and top of upper stack and push the biggest of them to the bottom stack, the smaller goes to acc.
* If we did not have any more input number in the sequence empty the bottom stack to out
* Using JRO makes it easy to split one box into several smaller programs

Currently at 2615 / 6 / 54

robertolofsson
Автор

Good job! My brain exploded halfway through. Would be nice to revisit this one later to see how it could be improved.

LukeTheTuque
Автор

in the node below the top stack, you have this code:

JMP S
L:MOV ... ...
JEZ END
L2:MOV ... ...
JMP L
END: ...

this should be changed to
JMP S
L2:MOV ... ...
L:MOV ... ...
JNZ L2
END:

this way we can get rid of jump in the middle of the loop

noamtashma
visit shbcf.ru