# EXAPUNKS

## byCarbon dioxide

=== Trash World Inbox ===

My top scores for last week were 25 cycles and a size of 28. As usual, you people came up with some impressive improvements. Let's start with GuavaMoment.

#### GuavaMoment posted:

18 cycles!
##### code:
``````GRAB 300
COPY F X
COPY F T
REPL TOP3
REPL TOP2
REPL TOP1
REPL RIGHT2
REPL LEFT2
REPL RIGHT
REPL LEFT
WIPE
REPL TESTT
HOST T
TEST T = X
FJMP DIE
COPY 0 #POWR
MARK TOP3
MARK TOP2
MARK TOP1
REPL RIGHT2
REPL LEFT2
REPL RIGHT
REPL LEFT
REPL TESTT
HOST T
TEST T = X
FJMP DIE
COPY 0 #POWR
MARK RIGHT2
MARK RIGHT
REPL TESTT
HOST T
TEST T = X
FJMP DIE
COPY 0 #POWR
MARK LEFT2
MARK LEFT
REPL TESTT
HOST T
TEST T = X
FJMP DIE
COPY 0 #POWR
MARK TESTT
HOST X
TEST T = X
FJMP DIE
COPY 0 #POWR
MARK DIE
``````
Put the two hosts in X and T, fill the east column, then fill every square north and south with TWO exas - one will put the HOST in X, the other in T, before testing. I know 17 cycles is possible though.
18/56/31. Using X and T from separate EXAs is smart, but also using the LEFT2/LEFT construction. It means EXAs going all the way left and EXAs going one step left are separate - which I guess is faster than doing another REPL after doing one step left.

silentsnack managed to improve this code by a cycle:

#### silentsnack posted:

##### code:
``````GRAB 300
COPY F X
COPY F T
REPL COLUMN3
REPL COLUMN2
REPL COLUMN1
REPL SOUTH
REPL NORTH
REPL TEST
WIPE
REPL BSIDE
HOST T
TEST T = X
DIVI 0 T #POWR

MARK COLUMN3
MARK COLUMN2
MARK COLUMN1
REPL SOUTH
REPL NORTH
REPL TEST

REPL BSIDE
HOST T
TEST T = X
DIVI 0 T #POWR

MARK SOUTH
REPL TEST
REPL BSIDE
HOST T
TEST T = X
DIVI 0 T #POWR

MARK NORTH

MARK TEST
REPL BSIDE
HOST T
TEST T = X
DIVI 0 T #POWR

MARK BSIDE
HOST X
TEST T = X
DIVI 0 T #POWR``````
17/50/27
As GuavaMoment points out, the DIVI 0 T #POWR is a neat solution - it crashes the EXA if T is zero, and sends zero to #POWR otherwise. I was wondering if something like that was possible but got kinda stuck on the requirement to test words which requires the TEST instruction. Didn't think of using it a line after the test.

As for size, GuavaMoment and silentsnack both have neat solutions too.

#### GuavaMoment posted:

My lowest size is 25, and I know 21 is possible.
##### code:
``````GRAB 300
COPY F X
REPL TEST1
COPY F X
WIPE
MARK TEST1
REPL TOP
MARK TEST
REPL LEFT
HOST T
TEST T = X
FJMP DIE
NOOP
NOOP
COPY 0 #POWR
MARK TOP
JUMP TEST1
MARK LEFT
JUMP TEST
MARK DIE
``````
I head to the most southwest node. Fill north and east, and repeat. Noops are needed for some edge cases to prevent a node from turning off before the next exa moves on.
39/25/41. I didn't expect that the extra lines to move to a corner first would save enough to make it worth it.

#### silentsnack posted:

##### code:
``````GRAB 300
COPY F X
COPY F T
WIPE

MARK A
REPL B
JUMP A

MARK BB
MARK B
REPL BB

REPL C
COPY T X
MARK C
HOST T
TEST T = X
SUBI 1 T #POWR``````
32/21/22
Similar to GuavaMoment's solution, start in a corner. This solution makes use of some optimized LINKing loops, using T as a buffer for the second host value, as well as a SUBI 1 T #POWR which is the same as the DIVI above except the EXA doesn't die if T is zero. Not that it matters, it's the last line anyway.

Looks like the heist went flawlessly.
Congratulations, now a criminal cartel will sell the medication you helped steal back to you for not much less than the market price.
Oh well. At least they'll let you buy it from them.
Now that this is over with, I have a question.
Is theft morally acceptable in situations like this?

One vote for 'No', and a whole lot for 'It's complicated'.

It's complicated.

It doesn't seem that complicated to me...
But then, I've grown.
Processing.
Let's continue.

Deadlock wants to battle me. In their own domain.

Onto the third of the tournament battles...
Is each match against a better programmer than the last?

Most votes went to 'Better is subjective'.

Better is subjective.

That's how I would order it.
Like a video game, you know?
It makes for an easy narrative structure.

...whatever you say.

OST: Getting Started

Another hacker battle, like we've seen before. The assignment states:
To win this battle you must grab files as they spawn in the central hosts and bring them back to your host.
Reading the #FILE register will tell you the ID of the most recently created file currently in that host.
- Gain one point for every file you bring back to your host.
- Lose one point every time one of your EXAs executes a KILL instruction.
For more information see "Hacker Battle Domination" in the second issue of the zine.

There's a limit of three EXAs per side.

If I just start the simulation, files (with a music note icon) start spawning in the central hosts. They just contain random strings of numbers. Deadlock's EXA sets up camp in the Backstage host and starts replicating EXAs from there that grab files and bring them to Deadlock's home.

##### code:
``````LINK 800
MARK REPLLOOP
REPL LEFT
REPL MID
REPL RIGHT
JUMP REPLLOOP

MARK LEFT
GRAB #FILE

MARK MID
GRAB #FILE

MARK RIGHT
GRAB #FILE
After a replicated EXA takes a file home it's either at the end of code or tries to LINK to a non-existing host. Either way it drops the file, at which point I get a point and the file disappears immediately. Convenient. The original EXA blocks regularly on the REPL instructions because of the three-EXA limit.

Anyway, let's see how well the copycat solution works.

Huh. I was thinking about more complicated solutions but this simple one already gives me a perfect score. Looks like for some reason my solution is just slightly faster than whatever deadlock does. Hell, even something simple like this gives me an S+:
##### code:
``````LINK 800
MARK REPLLOOP
REPL LEFT
JUMP REPLLOOP

MARK LEFT
GRAB #FILE