Part 3: TRASH WORLD NEWS - Tutorial 2
Part 3 - TRASH WORLD NEWS - Tutorial 2
Quackles posted:
Also, fun fact: If an EXA runs out of instructions, it will stop. This means it's possible to save an instruction by leaving off the HALT at the end.

GuavaMoment posted:
Do you have the physical version of this game?
Good luck getting through all the levels! There's one in particular at the end only 3 of my steam friends have beaten.



There's not much to see.





Alright, looks like next up is another tutorial.



Oh come on, lady. I need that to survive, it's not like I have a choice. That's not a reward.




Yes, survival, that's what I said... wait, did you just say "processing"? Hm, could it possibly be the case that the lady, whose window literally says "Emulated Multi-Branch Emotional Reasoning", is not in fact, human? 🤔


OST: Getting Started

Once again, one of the goals is "Leave no trace." Since that seems to be common, I won't be mentioning it anymore.
Clicking "Show Goal" in this case not only shows file 200 in the output, but it shows the value 436 appended to the end of the file.
Anyway, let's see what Ghast has to say about this tutorial.

Alright, just copy the code again. That I can do.

Code copied, and I started stepping through it. Just as a note - there doesn't seem to be a limit to how many lines of code a single EXA can have. There's only the global limit, which is 50 for this tutorial assignment.
Anyway, the LINK 800 took the EXA to the INBOX again, and the GRAB operation grabbed the file. As you can see, the file has moved from the file explorer under the "CREATE NEW EXA" button to being 'held' by the EXA's window.
Now, the new COPY operation does exactly what it says, it copies a value from one place to another. In this case, from the F register to the X register. However, the F register always points to whatever file the EXA's holding - and more specifically, the location of the cursor within the file. So F holds '72' right now.

The value 72 has been copied from F into X now, and the file's cursor moved to the next position. The cursor moves forward automatically whenever you interact with the F register.
The ADDI operation adds two values together (the first two arguments, X and F) and stores it in the register given by the third argument (X). So, it will add 72 from the X register to 52 from the cursor's location in the file.

Which makes 124 and moves the file cursor forward again. MULI works the same as ADDI, except it multiplies the values.

And SUBI subtracts the second value from the first.

The cursor is now at the end of the file.

If you use COPY to F while the cursor is at the end, it will append the value to the end of the file.
The rest of the program is stuff we've seen before. We move the file to the OUTBOX and destroy the EXA.


Not bad... but can I do better?

You may have thought of doing something like this. Use meaningless COPY operations to move the cursor to the end of the file and then just write a hardcoded value '436' in there. But that doesn't work - not only doesn't it save any time, the values in the file are different for each test run so only the first out of a hundred runs succeeds with this code.

What I can do is apply my learnings from the first tutorial. The HALT is unnecessary because an EXA destroys itself once it runs out of instructions, and the DROP is unnecessary because when an EXA destroys itself, it drops whatever it's holding.
This drops the cycle count to 9 and the size to 8.
There's one more trick that's less obvious. You can combine the COPY and ADDI operations like this:

Why does this work? Well, now the ADDI operation says "add the value in F to the value in F and store that to X". But, remember, EVERY interaction with F moves the cursor forward. So this actually adds the first value in the file to the second value and stores that in X, giving the same result with one less operation.

This drops both the size and count one further.






