Part 53: Trash World Roundup
Part 53 - Trash World Roundup=== Trash World Inbox ===
I finished the last puzzle with a score of 2653/98/11. Lurker Above posted a nice improvement.
Lurker Above posted:
I greatly enjoyed reading this LP. (And, admittedly, cribbed from it for postgame puzzles 5-8, which were a bit much for me.) Since my own solution for the final puzzle is (technically) an improvement for once, I figured I'd go ahead and post it:code:
;XA (LOCAL) MARK WRITEBOT GRAB 300 COPY F X DROP MAKE COPY X F COPY X F COPY X F MARK PACKING COPY M X TEST X > 0 FJMP SENDING COPY X F JUMP PACKING MARK SENDING ADDI X 1 T ;0 OR -9998 FILE X DROP REPL DELIVERBOT FJMP WRITEBOT;-9998 != 0 ;HALT MARK DELIVERBOT GRAB X LINK 800 LINK 885 COPY F X REPL DNSBOT COPY M F SEEK 1 ;THE BIG CHECKSUM THING COPY 0 X MARK SWIZONE SWIZ F 0001 T ADDI X T X TEST EOF FJMP SWIZONE SWIZ X 0001 X SEEK -9999 COPY #ADDR F;TIMESAVE SEEK 1 SUBI 0 X F COPY 0 X MARK SWIZTEN SWIZ F 0002 T ADDI X T X TEST EOF FJMP SWIZTEN SWIZ X 0010 X SEEK -9999 SEEK 2 SUBI F X X SEEK -1 COPY X F COPY 0 X MARK SWIZHUND SWIZ F 0003 T ADDI X T X TEST EOF FJMP SWIZHUND SWIZ X 0100 X SEEK -9999 SEEK 2 SUBI F X X SEEK -1 COPY X F COPY 0 X MARK SWIZTHOU SWIZ F 0004 T ADDI X T X TEST EOF FJMP SWIZTHOU SWIZ X 1000 X SEEK -9999 SEEK 2 SUBI F X X SEEK -1 COPY X F ;END CHECKSUMMARY LINK 800 ;SEE YOU SPACE COWBOY MARK DNSBOT GRAB 201 MARK DNSLOOP TEST F = X FJMP DNSLOOP COPY F M
There are basically four "programs" here: Writebot (XA), Readbot (XB), Deliverbot (XA:0), and DNSbot (XA:0:0).code:
;XB (LOCAL) GRAB 301 MARK READBOT COPY 30 X MARK READING COPY F M TEST EOF TJMP FINALE SUBI X 1 X TEST X > 0 TJMP READING COPY -1 M JUMP READBOT MARK FINALE COPY -9999 M
Writebot reads the target domain name, then creates the first packet, filling all three header values with the domain name string. It then receives a chunk of the data from Readbot to append to the packet, ending with either -1 (end of chunk) or -9999 (end of file). When Writebot gets a negative number, it adds 1 to it and stores it in T, then stores the packet's file ID in X, drops it, and then REPLs a Deliverbot. It then either FJMPs back to the beginning, or if EOF was reached it falls through to an invalid command and crashes because FJMP conveniently doesn't consider -9998 to be "false".
When spawned, a Deliverbot immediately grabs its assigned packet, moves over to Network, reads the domain name from the packet into X, and then REPLs a DNSbot, which grabs the DNS file, finds the domain's IP address, and sends that back to the Deliverbot, which in turn stores it in its proper place in the packet header. The Deliverbot then does four loops to calculate each digit of the checksum, adding the local IP address to the packet after one post-loop SEEK -9999 for efficiency's sake. Finally, with the header complete, it immediately delivers the packet.
2566/96/27. It's by no means optimal, but it's what I came up with. Anyway, I would definitely be interested in seeing solutions for the other two top percentiles, especially a 44-line solution.
Since the number of values is always a multiple of 6, you can then use the freed lines to unroll loops a little bit, e.g. do a @REP 2 around the SWIZ F mask T / ADDI X T X for 3 of the deliverbot's SWIZ loops, to drop the cycles score to 2459. I don't know if that's the best place to unroll, since I didn't try all possibilities.
To make it even faster it might also help to somehow cache the DNS data or the domain name in an additional EXA but finding available lines for that might be though. I didn't really attempt this, though.
There are some good guides for this game on the internet. I mostly kept away from them because I felt like copy-pasting from them wasn't in the spirit of this LP, but if you're interested in how to get the most optimal scores, you could check those out.
OST: Exapunks
Well, this was truly my final update. I'll keep the threads open, it's just that any further suggestions won't make it into the LP Archive.