The Let's Play Archive

EXAPUNKS

by Carbon dioxide

Part 17: Baby's first hacker battle

Part 17 - Baby's first hacker battle


=== Trash World Inbox ===

GuavaMoment posted:

This level is pretty straightforward without any neat tricks.
code:
XA:
GRAB 300
MARK LOOP
COPY F X
REPL REPL
COPY F M
JUMP LOOP
MARK REPL
LINK 800
LINK 799
GRAB 212
MARK LOOP2
TEST F = X
FJMP LOOP2
SEEK -1
COPY M F

XB:
LINK 800
GRAB 200
LINK 800
Find a keyword, make a copy to go change that keyword, repeat. 18 lines, saving 3 over yours. Sorry about naming my copies REPL all the time.
555/18/3. The REPL'd EXA goes find the word and gets the replacement from M. That also means the original EXA knows when the previous one is done.

GuavaMoment posted:

code:
XA:
GRAB 300
COPY F M
LINK 800
COPY F M
COPY F M
LINK 799
COPY F M
COPY F M
COPY F M
COPY F M
COPY F M
COPY F M
COPY F X
WIPE
COPY X M
KILL

XB:
NOOP
LINK 800
GRAB 200
LINK 800

XC:
LINK 800
LINK 799
GRAB 212
MARK LOOP
COPY M X
MARK LOOP2
TEST F = X
FJMP LOOP2
SEEK -1
COPY M F
SEEK -999
JUMP LOOP
Loop unrolling and transmitting data as fast as possible. The search takes the most time and it's hard to speed up. 540/32/7 a one cycle improvement (which I think comes from knowing how many keywords there are and wiping before transmitting the final keyword?)
And another small but neat improvement. I don't think this code needs much explanation.

While I was looking at your solution I had a very cheesy idea, though. I checked the slowest running test (only one of the test cases actually needed all 540 cycles). It is so slow because almost all the keywords are near the end of the file. Can we speed up just this one test case? That could be done by starting further ahead in the file and looping back to the beginning. I did a quick attempt but this made other tests much, much slower. Maybe there's a way to optimize that, I don't know. So, other idea, how about a reverse search? That's somewhat slow because you have to SEEK back a bit each loop - but can't hurt to try.

My first attempt failed. It uses the same XA and XB from Guavanaut, but with a changed XC:
code:
LINK 800
LINK 799
GRAB 212
MARK LOOP
COPY M X
SEEK 999
SEEK -1
MARK LOOP2
TEST F = X
SEEK -2
FJMP LOOP2
SEEK 1
COPY M F
SEEK -999
JUMP LOOP
For every new search value, it SEEKs to EOF, and then one back to the last word and starts testing. Every LOOP2 iteration it has to SEEK -2 to move back one word from where it last searched. That means it has to step forward one position when it finds the word but that's fine.

You see the problem here? SEEK -2; SEEK 1 causes an off-by-one if the keyword is the very first word in the file. New attempt with a workaround:
code:
LINK 800
LINK 799
GRAB 212
MARK LOOP
COPY M X
TEST F = X
TJMP FIRST
SEEK 999
SEEK -1
MARK LOOP2
TEST F = X
SEEK -2
FJMP LOOP2
SEEK 1
COPY M F
SEEK -999
JUMP LOOP

MARK FIRST
SEEK -1
COPY M F
JUMP LOOP
Now it checks the first position first. If that's the one, it replaces it in the FIRST 'subroutine' and jumps right back to search for the next. In that case it doesn't need to jump back to the beginning of the file because we never have to replace the same position twice. If the first word doesn't need replacing it SEEKs to the end and searches backwards.

504/41/7. Perhaps this could be optimized more but I'm quite happy I found this at all.

megane posted:

The joke is that this is the first tutorial mission network, so in addition to messing with Ghast's email you have to complete the now-hilariously-trivial tutorial task.
:doh: Of course! It's the exact same as the very first tutorial assignment. I guess that's how Ember found us a way in, but if we don't solve the tutorial, Ghast might get suspicious.


=== Hacker battle at KGOG-TV ===

You didn't look at any other files while you were in there, did you?



Everyone voted for "I might have". Very honest.

Oops!
Maybe don't tell him you accidentally saw some of his private files.
No reason to upset him.
He needs to focus on the next issue of the zine anyway.


Yeah, ok.

Speaking of the next zine, I got it right here.

OST: Apartment

Nice cover:




I'm assuming the physical version came with actual 3D glasses.



It's completely filled with cool content again. I don't think Ghast's the best hacker out there - but he's a damn good editor. Also, I can't believe it's been only one month since the first issue. Feels like three months at least.

Anyway, we'll get to the hacking writeups when we need them. As for the other content, I'll be sharing that bit by bit again just to not overwhelm you with text. Let's start with Ghast's letter.



I'd love to stay curious, but I'm just trying to survive here, man.

Let's see what's going on online.





Well, mutex is challenging us to a "hacker battle". Can't say no to that.

Hacker battles have a different kind of leader board. They show who you've beaten and when. Apparently this is stored in the Steam cloud separately from your regular save file because it has a date corresponding to my initial playthrough (and I'm not using that save). Other than mutex8021, it shows my steam friends. I removed those from the pic for privacy reasons.

You're going to join in on a hacker battle?
But you never say anything in the chat room...




Two votes for "I just lurk", one for "EXAs speak louder".

I just lurk these days.

I guess the only thing that really matters is your ability.



As it should be.

It's a nice ideal.


Oh hey cool, Ember is all 3D with these glasses Ghast gave me.

Right, time to find out what this is all about.


OST: Getting Started

This is a completely different mode of the EXODUS simulator. There's some things to go through. Let's start with some info from the zine.





The left side looks very familiar. Some files and the EXA programming environment.



On the right we see some new things. The dark/blue host is our opponent's. We can never go there, but they can link from it to the network we're hacking.

At the bottom we see there's 100 test runs, like normal. New is the win count: this is increased by one for every test run where you get more points than your opponent. The goal is to get a win count that's greater than half of the number of test runs.

Next, the number of cycles is limited now - that's how long the program will run for during any test run before the points are added up. The size count is limited as always.

To the far right you see the points you and your opponent have and the storage limit. The storage limit is the number of EXAs you're allowed to create. It's 3 here - that means I can't have more than 3 EXAs to start with, and if my code REPLs to more than 3, the REPL instruction will pause that EXA until there's space again. As for how to get points, we need to read the instructions:

To win this battle you must make your movies play for longer than your opponent's. A movie will play when that movie's file is the only movie file sitting in a channel host.
- Gain one point every cycle for each of your movies that is playing (files 210 and 211).
- Lose one point every cycle for a movie that isn't yours (files 230, 231, 265) is held by an EXA you control or is sitting in your host.
- Lose one point every time one of your EXAs executes a KILL instruction.
Note that you may only battle your Steam friends after beating the NPC opponent. To view the list of possible opponents, click the "SELECT OPPONENT" button above.
For more information see "Hacker Battle Domination" in the second issue of the zine.


Alright, so I can use KILL instructions to kill the opponent's EXAs but it will cost me points.

Hey game, stop breaking the fourth wall. I'll get to Steam friends battles in a bit. Let's start with mutex.

If we don't do anything, mutex uses two EXAs to move 230 and 231 to the channels and they get 2 points per cycle (since file 265 doesn't give anyone points).



In case you're wondering, 265 is a movie of a bug moving next to a plant, 230 looks like some military device shooting missiles, and 231 is a mechanical monster walking throuch a city.

To prevent mutex from getting points, I could either kill their EXAs or grab their files. Since holding files that aren't mine costs points, and I can't beat mutex's first EXA to grabbing a file, I'm better off just killing them. I have to execute the KILL instructions while I'm in the same host as the opponent's EXAs. There can't be any other EXAs of mine there, because as the language reference guide in zine 1 says, for some reason KILL prioritizes your own EXAs.

So, let's start with this simple solution.



XA kills both of mutex's EXAs (giving me negative 2 points), then moves one of my files into an empty channel host. XB waits for the kills, then moves the other file over. As soon as both EXAs drop the files they start playing, and I get 2 points per cycle.



My movies are some swaying grass with figures in the background, and a Japanese looking scene with snow falling.

So you might think it's a good idea to get rid of file 265 too, or dump another movie in that host to cause a conflict. Turns out it isn't. Grabbing 265 or another opponent's file costs points. And the instructions for this battle are actually incorrect. You don't lose any points for having someone else's movie playing, the only thing that happens is that the opponent GAINS points if they have their movies playing. Since 265 is nobody's, no-one is gaining any points for it and I should just leave it alone.

This solution nets me 188 points for every test run, while mutex gets zero. By the way, the other test runs are almost identical. All that changes it the number in the third entry of each file, and the locations of mutex's and my host change around (while keeping the link IDs the same). I suspect that last change swaps who moves first within a cycle, but it doesn't matter for us.



I win every single test run, getting an S+ score on this battle.



This first hacker battle is very easy. It's more of a tutorial for a new mode than anything else.

As for the multiplayer mode, you're not battling at the same time. What happens is that after I beat the NPC, my solution becomes available for Steam friends to battle against. That means their goal becomes to specifically beat my solution. If you noticed - the battle field is basically symmetric, the only difference is some file IDs but the game can just replace them when simulating someone being "the other side".

I tried to pit my solution against someone else's and I lost every test run. It's hard to say what they did exactly - you can't see the opponent's code. But they use three EXAs, one of which tries to kill mine and another which constantly replicates, moving the repls into the channel hosts.

The way to handle this is to build another solution to specifically fight theirs. For instance, I changed XA to kill just once (it gets killed by an opponent in the same cycle) and then sent in a second EXA that aggressively kills both of the remaining opponent's EXAs.
I managed to secure a win, 76 out of 100 test runs. Good enough for a B. I can't really tell you why 'only' 76 runs, the interaction of two sets of separately programmed EXAs gets very unpredictable.

Either way, by doing so my new solution is uploaded to this specific Steam friend, so if they decide to ever reopen the game and scroll to this particular assignment, they can see I beat them and they can try to make a new solution to beat mine. I don't have much experience with this because the few Steam friends I have that also own this game apparently were happy to play through it just once, but I can imagine this way you could get a fun back-and-forth on these hacker battle levels.

Back to the plot.

You're off to a good start.
I knew you were good at what you did.
Even after you forgot, you picked it right back up.
That's why I contacted you.




The first vote for today.

For the second vote, Ember has a question about the Redshift handheld Ghast handed us.

Why do you think Ghast gave you this?





[Ghast] let's just say I'm pretty confident.
[x10x10x] cool im gonna hacker battle moss too


Oh... um, I don't think I ever introduced myself properly to you all, readers. Not that you would've believed it was really me, seeing how much I had to relearn at the start. I'm the hacker known as Moss. Nice to make your acquaintance. You've seen my name in the chat's user list, I just lurk all the time.