Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
silentsnack
Mar 19, 2009

Donald John Trump (born June 14, 1946) is the 45th and current President of the United States. Before entering politics, he was a businessman and television personality.

edit: wrong tab whups

Carbon dioxide posted:

The size is still 11, and according to the histograms, 10 is possible, and so is a sub-200 cycle account. If anyone has any thoughts on how to get there, please share them.
To reduce solution size you can combine the "we need a file containing N+1 entries" with "we need to retrieve N from a file" into a single step by using ADDI F 1 [?] instead of COPY F [?] and changing the order slightly, e.g. with a single exa
code:
LINK 800
GRAB 200
LINK 800
ADDI F 1 T
WIPE
MAKE
MARK WATT
SUBI T 1 T
COPY T F
TJMP WATT
Size 10
Cycles 307
Activity 2


edit N+1

Another thing you can streamline is the fact that the TJMP step itself takes a cycle, so if you can pack more useful operations into a given execution of the loop the exa wastes less time doing its logic check. This ugly abomination does batches of 2 variables but as an ugly kludge has to work around the fact that it even numbers and odd numbers behave differently (it does this by adding another dummy entry at the beginning, then erasing it once the iterator has finished doing its thing)
code:
LINK 800
GRAB 200
LINK 800
ADDI F 1 X
WIPE
MAKE
MODI X 2 T
TJMP EVEN
COPY X T
MARK LOOPA
SUBI T 1 F
SUBI T 2 F
SUBI T 2 T
TJMP LOOPA

HALT

MARK EVEN
ADDI X 1 T
MARK LOOPB
SUBI T 1 F
SUBI T 2 F
SUBI T 2 T
TJMP LOOPB
SEEK -9999
VOID F
Cycles: 212
Size: 24
Activity 2

:doh: A couple of further tweaks actually make it a lot easier just to split it into two loops, by varying the number (in this case 8) you can change the batchsize
code:
LINK 800
GRAB 200
LINK 800
ADDI F 1 X
WIPE
MAKE
MODI X 8 T
SUBI X T X

FJMP EVEN

MARK LOOPA
SUBI T 1 T
ADDI X T F
TJMP LOOPA

MARK EVEN
COPY X T
MARK LOOPB
@REP 8
SUBI T @{1,1} F
@END
SUBI T 8 T
TJMP LOOPB
Cycles 143
Size 26

...which is both faster and also slightly less horrendously inelegant, but I dunno if you really want to get into @rep structures just yet.

silentsnack fucked around with this message at 04:29 on Dec 19, 2021

Adbot
ADBOT LOVES YOU

silentsnack
Mar 19, 2009

Donald John Trump (born June 14, 1946) is the 45th and current President of the United States. Before entering politics, he was a businessman and television personality.

Oof. This puzzle made my brain hurt. There's a trick to speeding up operations by running multiple instances in parallel instead of sequentially, but then you have to deal with non-deterministic outcome of race conditions like when two EXAs try to take the same link in the same frame, so solutions would sometimes work and sometimes break for no apparent reason. This was my previous fastest solution, with some fairly insane workarounds:

code:
;====XA====
LINK 800
COPY #NERV X; WHY
COPY #NERV T; DOES
@REP 4
LINK 1
@END
COPY X #NERV; THIS
REPL OUT
COPY T #NERV; WORK
MARK OUT
@REP 2
SUBI M 120 #NERV
@END
JUMP OUT

;====XB====
NOOP
MARK LOOP
REPL LOOP
LINK 800
ADDI #NERV 120 X; ???
LINK 1
DIVI X 170 T;WTF HAX
LINK 1
FJMP BANDPASS
TEST X > 0
MULI T 170 M
HALT
MARK BANDPASS
LINK 1
COPY X M
38 cycles / 29 size / 137 activity.

All of the superfluous LINK 1 interlaced in the logic was because I kept running into problems with race conditions and/or having too many EXAs pile up in a host. I guess 38 is okay, and as a plus it looked really stupid in motion:


Quackles posted:

If a number goes above 9999 or -9999, it is set to 9999 or -9999.

Ah, yeah this is what I was missing. Uggggh.

code:
LINK 800
MARK LOOP
REPL LOOP
ADDI #NERV 35 X
MULI X 117 X
DIVI X 117 X
MARK OUT
LINK 1
REPL OUT
SUBI X 35 #NERV
Previous smallest I could get was 12 lines, but this clearly beats it at 86 cycles / 10 size / 130 activity, and basically just plugging in the same multiply-divide trick and deleting all the now-superfluous kludgecraft:

code:
;====XA====
LINK 800
@REP 4
LINK 1
@END
MARK OUT
REPL OUT
SUBI M 35 #NERV

;====XB====
MARK LOOP
REPL LOOP
LINK 800
ADDI #NERV 35 X
LINK 1
MULI X 117 X
DIVI X 117 M
Now down to 36 cycles / 15 size / 73 activity.

...and as the other world-weary burnouts have said, "you get used to it" and "this is silly"

silentsnack fucked around with this message at 02:28 on Jan 1, 2022

silentsnack
Mar 19, 2009

Donald John Trump (born June 14, 1946) is the 45th and current President of the United States. Before entering politics, he was a businessman and television personality.

Carbon dioxide posted:

A 1-activity solution would be possible only if we could grab the last date from the log file and reuse that. However, the devs thought of that and have a test where the oldest log line isn't from today, so that won't work.

Finally, it looks a decent improvement possible in the size is possible. I'd love to see what the thread comes up with.

Dunno, kinda vague but also Doubtful

This one has a some reasonable optimizations and one really stupid trick. First up to reduce file size you can simply test every single value instead of skipping over the ones you know expect to return false, at the expense of wasting a lot of cycles. Also instead of having to COPY F M to transmit the ID which you'll need on multiple EXAs and necessitates another COPY M X operation, you can just COPY F X and then REPL

code:
GRAB 300
COPY F X
LINK 800
REPL B
WIPE
GRAB 201
LINK 801
SEEK 9999
COPY #DATE F
LINK -1
COPY X F
COPY M F
COPY M F
MARK B
GRAB 200
MARK LOOP
TEST X = F
FJMP LOOP
COPY F M
COPY F M
SEEK -2
COPY 0 F
COPY 0 F
Brings it own to 99 cycles / 23 size / 3 activity

And for reducing the cycle count... think of the silliest thing you could try to make a program run faster, and see how it compares to what you're about to see. First here's something with generally the same general function+structure as your 58 cycle solution, but uses loop unrolling and TJMP spam to make the file search run a bit faster
code:
;====XA====
LINK 800
GRAB 200
COPY M X
MARK LOOP
@REP 8
TEST X = F
TJMP FOUND
SEEK 2
@END
JUMP LOOP
MARK FOUND
COPY F M
COPY F M
SEEK -2
COPY 0 F
COPY 0 F

;====XB====
GRAB 300
COPY F X
COPY X M
LINK 800
WIPE
GRAB 201
LINK 801
SEEK 9999
COPY #DATE F
LINK -1
COPY X F
COPY M F
COPY M F
57/48/4 which is a slight improvement over 58 cycles. And now for the same solution but a couple of lines changed to use a slightly different routine to parse the file:

code:
;====XA====
LINK 800
GRAB 200
SEEK 99
COPY M X
SEEK -3
MARK LOOP
@REP 8
TEST X = F
TJMP FOUND
SEEK -4
@END
JUMP LOOP
[etc...]
For whatever reason, the distribution of file lengths and position of the target line make the longest solution faster to find by jumping to the end and searching backwards, even with the added time to get the file pointer into the right position this one runs 55/50/4.

silentsnack
Mar 19, 2009

Donald John Trump (born June 14, 1946) is the 45th and current President of the United States. Before entering politics, he was a businessman and television personality.

GuavaMoment posted:

You can have one exa feeding in the row data:
One feeding in the column data:
One feeding in data from the file
and one to kill everything at the end


86/30/6, still one cycle off top percentage though...

If you're aiming for the theoretical minimum cycle count, you need your first #DATA input to be on cycle 2 (and then keep writing once every cycle. But as I later noticed we both ran into similar problems with getting the exit/cleanup down to 0 cycles)

code:
;XA
COPY 1 X
LINK 800
NOOP
MARK LOOP
REPL DO_THE_THING
ADDI X 1 X
JUMP LOOP

MARK DO_THE_THING
DIVI X 9 #DATA
MODI X 9 #DATA
COPY M #DATA

;XB
LINK 800
COPY 0 #DATA
COPY 0 #DATA
COPY M #DATA
COPY 38 T
MARK WAIT
SUBI T 1 T
TJMP WAIT
KILL
KILL

;XC
GRAB 300
MARK NOT_3
@REP 2
COPY F M
@END
JUMP NOT_3
84/26/4

This is about where the game starts throwing puzzles at you with enough complexity where it becomes more relevant that when an EXA tries to write to the M register, even if one is already waiting to receive, the sender still has to waste a cycle in the "I'm waiting to send!" state.

Also the @REP in XC needs to be any number that isn't 3 or 9 because if the loop trying to JUMP then XC doesn't crash until another cycle later when trying to arithmetic a nil due to EOF.

edit: it can actually be 24 lines instead of 26 if you don't mind being harder for human readers to parse, since if XA and XB are both trying to LINK 800 then XB goes first, drop XA's NOOP and COPY setup and swap the ADDI and REPL lines.

...also it occurs to me that it might be possible to make it even faster. Just gotta crash all EXAs on the same cycle #DATA is finished. The issue with the previous arrangement was being unable to kill XA before XA:26 wrote the last character, but that delay also required killing XA:27 which wasted a cycle.

code:
;XA
MARK LOOP
ADDI X 1 X
NOOP
REPL LOOP

LINK 800
DIVI X 9 #DATA
MODI X 9 #DATA
COPY M #DATA

;XB
LINK 800
COPY 0 #DATA
COPY 0 #DATA
COPY M #DATA

;XC
GRAB 300
@REP 26
COPY F M
@END
KILL
COPY F M
83/41/29

...which turns out to be an even cruder approach, forgoing loops in favor of recursion and bruteforce @REP spam

silentsnack fucked around with this message at 05:50 on Jan 23, 2022

silentsnack
Mar 19, 2009

Donald John Trump (born June 14, 1946) is the 45th and current President of the United States. Before entering politics, he was a businessman and television personality.

GuavaMoment posted:

I've also got an 83 cycle solution now. Sending file 300 data over M saves a cycle from not having to wipe the file. I have a bunch of killer exas though and the solution is entirely dependent on exa ordering (which I found from trial and error) so the right exas get killed at the right times to save the last two cycles. It's clunky but it works.

Another minor refinement is to combine two things I'd mentioned separately: we know file 300 has 27 entries and we need to COPY M #DATA on cycles [4,7,10,13...] so we need a COPY F M on [3,6,9,12...] since writing to M takes 2 cycles to complete, which lets us squeeze in some control logic instructions on [5,8,11,14...] and have XC loop/break smoothly so it kills XA at the right time and terminates on cycle 82
code:
;XC
GRAB 300
COPY 12 T
MARK LOOP
COPY F M    ;3...
SUBI T 1 T
COPY F M    ;...73
TJMP LOOP

COPY F M    ;75~76
COPY F M    ;77~79
KILL
COPY F M    ;81~82
Same cycles/activity but much smaller size with 83/23/28

silentsnack fucked around with this message at 20:42 on Jan 23, 2022

silentsnack
Mar 19, 2009

Donald John Trump (born June 14, 1946) is the 45th and current President of the United States. Before entering politics, he was a businessman and television personality.

1: depends on your definition of "friends"
2: depends on your definition of "always" :v:

Carbon dioxide posted:

Shaving off those last three cycles is going to be tricky. Perhaps we can get rid of those unconditional jumps, but most of my ideas would require making more EXAs earlier and that wouldn't save any cycles because only one EXA can traverse any network link at a time.

I also attemped doing something where it tries to find the file after each step. But a GRAB on a non-existing file destroys the EXA, so you'd have to do a REPL first. A REPL blocks the EXA forever if there's no place for the clone (when there's an enemy EXA or even just a file sitting in the other square of the host). So that's not going to work. I'll leave this one to the thread.


For the small solution, you can also use "link to a variable" and rearrange the code to fall through from the cloning operation to a different version of the clone, which eliminates the need for a JUMP/MARK pair in order to make both EXAs merge onto the same script.

code:
MARK LOOP
ADDI X 1 X
COPY 800 T
REPL FORK
COPY 801 T
MARK FORK
LINK T
DIVI X 4 T
FJMP LOOP

KILL
GRAB 276
MARK OUT
LINK -1
JUMP OUT
40/14/27



And as you mentioned, if you want the fastest solution for this puzzle you don't have any spare cycles for clever/elegant JUMP flow control, just weapons-grade spaghetti
code:
LINK 800
REPL 5
LINK 800
REPL 37
LINK 800
REPL 2468

LINK 800
KILL
GRAB 276
@REP 4
LINK -1
@END
HALT

MARK 2468
LINK 801
KILL
GRAB 276
@REP 4
LINK -1
@END
HALT

MARK 37
LINK 801
REPL 2468
[...]

MARK 5
LINK 801
[...]
15/46/27


edit: part of the challenge in this problem is the fact the target host has very limited room. So if we use the recursive self-replication trick we need some way to avoid forkbombing ourselves into an impassable traffic jam. In this case we know the destination is exactly 4 jumps away so we can just make the loop somehow end after 4 jumps, easily done by adding a count variable to the loop.

But here's a more general solution that would work in just almost any arbitrary-sized network (so long as there's no other traffic) but the code is bigger/slower because each clone cycle the main loop needs to spawn a separate process to handle the kill/grab/return routine, but the loop also needs to attempt to crash before it runs out of space to duplicate itself:
code:
MARK LOOP
COPY 800 T
REPL FORK
COPY 801 T
MARK FORK
REPL EXFIL
LINK T
LINK T
LINK -1
JUMP LOOP

MARK EXFIL
LINK T
KILL
GRAB 276
MARK OUT
LINK -1
JUMP OUT
less optimal at 44/17/63

silentsnack fucked around with this message at 02:55 on Jan 30, 2022

silentsnack
Mar 19, 2009

Donald John Trump (born June 14, 1946) is the 45th and current President of the United States. Before entering politics, he was a businessman and television personality.

Carbon dioxide posted:

By the way, using numeric MARK names doesn't make the code any easier to read.
whups yeah that was just a crutch to make writing easier, using the scheme of the hosts already being labeled P-1000 through P-8000

GuavaMoment posted:

My fastest solution is fundamentally identical to yours, I've just found a few cycles to squeeze out of some places, and I squoze one more cycle out from the seek 124 trick; I was previously seeking to the end and going backwards through the files. 89/70/7

Files are at least 15 entries, but it's also possible to exploit the fact that they don't get much bigger, and that there are at most 7 files per tape. And you don't necessarily have to find the correct host since the filename is unique.

code:
;XA
LINK 800
LINK 800
LINK 800
COPY M X
REPL TAPE1
LINK 800
LINK 800
MARK TAPE2
LINK 800
LINK 800

MARK WHERE
GRAB 200; HOST = DGAF
SEEK 126
TEST X = F
@REP 6
TJMP WHICH
SEEK 2
TEST X = F
@END
DIVI T T T

MARK WHICH
COPY F X
COPY F T
REPL WHEN
SEEK -999
SEEK X
MARK WHAT
@REP 9 ; SIZE 15~18
COPY F M
@END
JUMP WHAT

; AWKWARD!
MARK TAPE1
REPL TAPE2
JUMP WHERE

MARK WHEN
COPY T M
MARK KILLSWITCH
SUBI T 1 T
TJMP KILLSWITCH
KILL

;XB
GRAB 300
VOID F
COPY F M
SEEK -2 ; RECYCLE F.300
SUBI M 1 T
REPL KILLSWITCH

MARK WRITE
COPY M F
JUMP WRITE

MARK KILLSWITCH
SUBI T 1 T
TJMP KILLSWITCH
NOOP
KILL
74/73/11

The REPL TAPE1 branch is because it takes the longest to reach TAPE3, so that one will be the limiting case and its EXA does as little else as possible. But the fact it's running a single codeblock and JUMP detours take more time, it required finding some place to wedge in between other operations.

For reducing size further, dividing by zero is an efficient way to crash an EXA. As is grabbing a nonexistent file.

code:
;XA
GRAB 300
COPY F X
COPY F X
WIPE
LINK 800

MARK WHERE
LINK 800
LINK 800
GRAB 200
REPL WHERE

MARK SEARCH
TEST X = F
FJMP SEARCH

COPY F X
COPY F T
SEEK -999
SEEK X

MARK WHAT
COPY F M
SUBI T 1 T
COPY T M
TJMP WHAT

;XB
MAKE
MARK WRITE
COPY M F
DIVI 1 M X
JUMP WRITE
420/27/9

also here's a vote for 'thanks' even if it's just a meaningless nicety. as for the other question, who *doesn't* have a weird history with berkeley's EECS department?

silentsnack fucked around with this message at 20:14 on Feb 5, 2022

silentsnack
Mar 19, 2009

Donald John Trump (born June 14, 1946) is the 45th and current President of the United States. Before entering politics, he was a businessman and television personality.

idhrendur posted:

How long have you pretended to be human
Yeah, a lot



Carbon dioxide posted:

let me know what further improvements are possible.

Looking at my solutions... I don't even remember writing this but aside from obviously being the product of trial and error it seems crude/unfinished? Maybe I'm just tired but I'm not seeing what it does all that differently, other than minor improvements like combining COPY F X and an ADDI X F X operation into ADDI F F X.
code:
;XA
GRAB 300
COPY F X
WIPE
LINK 800
GRAB 199
MARK FIND
TEST F = X
SEEK 2
FJMP FIND

SEEK -1
COPY F M

;XB
LINK 800
LINK 799
GRAB M
SEEK 2

ADDI F F X
@REP 7
ADDI X F X
@END
MARK ADD
ADDI X F X
TEST EOF
FJMP ADD

SEEK -999
SEEK 2
DIVI X 1800 T
MODI X 1800 X
MARK WRITE24
@REP 24
COPY 75 F
@END
SUBI T 1 T
TJMP WRITE24

DIVI X 225 T
FJMP END
MODI X 225 X
MARK WRITE3
SUBI T 1 T
@REP 3
COPY 75 F
@END
TJMP WRITE3

MARK END
TEST X > 75
FJMP BREAK
SUBI X 75 X
COPY 75 F
JUMP END

MARK BREAK
COPY X F
But somehow the stats are showing 195/75/3

silentsnack
Mar 19, 2009

Donald John Trump (born June 14, 1946) is the 45th and current President of the United States. Before entering politics, he was a businessman and television personality.

Sometimes/how?

You can use some fallthrough structure to reduce size too
code:
LINK 800
MARK A
DIVI #NERV -10 X
SUBI X 2 T
REPL B
LINK 1
LINK 1
COPY 40 #NERV
COPY -70 #NERV

MARK BEAT
COPY -70 #NERV
SUBI T 1 T
TJMP BEAT

LINK -1
LINK -1
JUMP A
MARK B
LINK 3
LINK 3
COPY -70 #NERV
COPY 40 #NERV
JUMP BEAT
119/22/41

And to reduce time, the usual parallel countdown/kill shenanigans can work

code:
LINK 800
DIVI #NERV -10 X
SUBI X 2 T
REPL A

MARK LOOP
SUBI T 1 T
TJMP LOOP
DIVI #NERV -10 X
SUBI X 2 T
REPL LOOP

MARK A
REPL B
LINK 1
LINK 1
REPL TIMER
COPY 40 #NERV
COPY -70 #NERV
COPY -70 #NERV
JUMP BEAT
MARK B
LINK 3
LINK 3
REPL TIMER
COPY -70 #NERV
COPY 40 #NERV
MARK BEAT
COPY -70 #NERV
JUMP BEAT

MARK TIMER
SUBI T 1 T
TJMP TIMER
KILL
63/32/31


edit: ...and after randomly thinking about this again a couple of days later, it occurs to me that there might be a more efficient way make the timers and #NERV writing run both in parallel and serial, but actually implementing that plan ends up requiring a special-case for the first pair:
code:
LINK 800

REPL A0
DIVI #NERV -10 X
SUBI X 2 T
REPL A

MARK LOOP
SUBI T 1 T
TJMP LOOP
DIVI #NERV -10 X
SUBI X 2 T
REPL LOOP

MARK A
REPL B
LINK 1
LINK 1
MARK WAIT_A
SUBI T 1 T
TJMP WAIT_A
KILL
JUMP ADATA

MARK B
LINK 3
LINK 3
MARK WAIT_B
SUBI T 1 T
TJMP WAIT_B
KILL
JUMP BDATA

MARK A0
REPL B0
LINK 1
LINK 1
NOOP
NOOP
MARK ADATA
COPY 40 #NERV
COPY -70 #NERV
COPY -70 #NERV
JUMP BEAT

MARK B0
LINK 3
LINK 3
NOOP
NOOP
MARK BDATA
COPY -70 #NERV
COPY 40 #NERV

MARK BEAT
COPY -70 #NERV
JUMP BEAT
62/50/45

1 cycle faster but it's tiredbrain'd garbagecode

silentsnack fucked around with this message at 06:58 on Feb 28, 2022

silentsnack
Mar 19, 2009

Donald John Trump (born June 14, 1946) is the 45th and current President of the United States. Before entering politics, he was a businessman and television personality.

code:
LINK 800

MARK LOOP
ADDI X 1 X
SWIZ X 3 #PASS
SWIZ X 2 #PASS
SWIZ X 1 #PASS
REPL LOOP

LINK 800
GRAB 199
COPY F T
DROP
LINK -1
KILL
LINK -1
MAKE
SWIZ X 3 F
SWIZ X 2 F
SWIZ X 1 F
COPY T F
4969/19/9 with an amusing quirk the timings on the KILL let one clone escape to make a second file with password N+1, but there's no penalty for leaving our own machine full of irrelevant garbage files so long as one of them is correct.

code:
;====XA====
MAKE
COPY 2 F
COPY 16 F
COPY 30 F
COPY 54 F
COPY 73 F
COPY 104 F
COPY 108 F
COPY 109 F
COPY 158 F
COPY 160 F
COPY 161 F
COPY 169 F
COPY 173 F
COPY 177 F
COPY 181 F
COPY 202 F
COPY 207 F
COPY 953 F
COPY 990 F
COPY 971 F
COPY 0 F

SEEK -99
MARK LMAO
COPY F T
REPL TEST
TJMP LMAO

COPY 215 T
MARK LOOP
ADDI T 1 T
REPL TEST
JUMP LOOP

MARK TEST
LINK 800
SWIZ T 3 #PASS
SWIZ T 2 #PASS
SWIZ T 1 #PASS

LINK 800
GRAB 199
COPY T M
COPY F M
KILL

;====XB====
MAKE
COPY M X
KILL
KILL
SWIZ X 3 F
SWIZ X 2 F
SWIZ X 1 F
COPY M F
2253/50/748 - bullshitting our way to crazy statistics :v:


megane posted:

I bet it was fun
Making something is its own reward


edit:

GuavaMoment posted:

...aside from leaving incorrect files in your home node, but as long as one of them is correct it works. I played the entire game naming my REPLs as REPL. I wonder if there is a fancy MODI command to cycle through every number and have that exa die on it's own at some point instead of using ADDI X 1 X. That would save the need for the KILL command.
It takes additional instructions to do, but you can use the fact that (9999+1)=9999 in EXArithmetic, so you can make your script compare values each cycle and once (XN - XN-1)=0 then you know you've run out of numbers.

another method for execution/flow control is to pass a token between EXAs, like the M register or having each generation attempt to run a sequence that becomes invalid due to another EXA specifically not crashing:
code:
LINK 800
MAKE
DROP
MARK LOOP
ADDI X 1 X
GRAB 400
SWIZ X 3 #PASS
SWIZ X 2 #PASS
SWIZ X 1 #PASS
REPL LOOP
LINK 800
WIPE
GRAB 199
COPY F T
REPL RETURN
MARK RETURN
LINK -1
MAKE
SWIZ X 3 F
SWIZ X 2 F
SWIZ X 1 F
COPY T F
JUMP RETURN
23 lines, no KILL. If you want the minimum possible Activity score then just use a well-timed TEST MRD to break the keygen loop


Tinkering around further, turns out splitting the LMAO subroutine across two separate EXAs saved a bunch of cycles/lines. Also looks sillier, which is extremely important.
code:
;==== XA M=LOCAL ====
MARK LMAO
COPY M T
REPL TEST
TJMP LMAO

COPY 232 T
MARK LOOP
ADDI T 1 T
REPL TEST
JUMP LOOP

MARK TEST
LINK 800
SWIZ T 3 #PASS
SWIZ T 2 #PASS
SWIZ T 1 #PASS

LINK 800
GRAB 199
MODE
COPY T M
COPY F M

;==== XB M=LOCAL ====
COPY 2 M
COPY 16 M
COPY 30 M
COPY 54 M
COPY 73 M
COPY 104 M
COPY 108 M
COPY 109 M
COPY 158 M
COPY 160 M
COPY 161 M
COPY 169 M
COPY 173 M
COPY 177 M
COPY 181 M
COPY 202 M
COPY 207 M
COPY 216 M
COPY 221 M
COPY 953 M
COPY 971 M
COPY 990 M
COPY 0 M

;==== XC M=GLOBAL ====
MAKE
COPY M T
KILL
KILL
SWIZ T 3 F
SWIZ T 2 F
SWIZ T 1 F
COPY M F
2186/50/732 and as noted XA and XB need to start in local communication mode, which dunno if you've covered that yet.

silentsnack fucked around with this message at 03:49 on Mar 20, 2022

silentsnack
Mar 19, 2009

Donald John Trump (born June 14, 1946) is the 45th and current President of the United States. Before entering politics, he was a businessman and television personality.

GuavaMoment posted:

No idea. Spacechem has different properties on different platforms, so maybe he's not on windows?

Nope. Copypasting CO2's 2918-cycle solution gives the same statistics, which should mean in the slowest run both our machines count up to the same highest value of 990.



Assuming all three of us are running the same version of the game with the same pseudorandom seed; did you maybe mean "1967" in your post and/or skip a trivial detail in your explanation? The former would roll over from 1000 to 999 and SWIZ 321 is effectively MODI 1000 but as for the latter...

SWIZ 1967 321 X = SWIZ 967 321 X = 967
SWIZ -1 321 X = -1

MODI 1967 1000 X = MODI 967 X = 967
MODI -1 1000 X = 999

...MODI behaves differently with negative numbers.

silentsnack
Mar 19, 2009

Donald John Trump (born June 14, 1946) is the 45th and current President of the United States. Before entering politics, he was a businessman and television personality.

A/C

As for solution optimizations you can reduce size a bit more by dropping the EOF test

code:
;M=LOCAL
GRAB 300
MARK CLONE
ADDI F 2000 X
REPL TRAVERSE
JUMP CLONE

MARK TRAVERSE
LINK 800
REPL TRAVERSE
SWIZ X 421 X

GRAB X
REPL WRITER

MARK READ
COPY F M
JUMP READ

MARK WRITER
MAKE
MARK W_LOOP
COPY M F
NOOP
TEST MRD
TJMP W_LOOP

MARK HOME
LINK -1
JUMP HOME
289/24/87

And faster solutions are possible if you leverage the fact that all the files have >34(?) entries, and save lines for the unroll by squeezing some control operations into cycles where the receiver is waiting for the next M signal.
code:
;M=LOCAL
GRAB 300
@REP 4
ADDI F 2000 T
REPL SKIP
@END
ADDI F 2000 T
WIPE

MARK SKIP
LINK 800
MARK TRAVERSE
LINK 800
REPL TRAVERSE

SWIZ T 421 T
GRAB T
REPL WRITER

MARK READ
@REP 18
COPY F M
@END
JUMP READ

MARK TIMER
SUBI T 1 T
TJMP TIMER
COPY 0 M
HALT

MARK WRITER
MAKE
COPY M F;  [[COPY--
COPY 15 T

MARK WRITE_BATCH
COPY M F;  --TO--
SUBI T 1 T
COPY M F;  --FILE--
TJMP WRITE_BATCH

COPY M F;  --EVERY--
COPY 34 T
COPY M F;  --OTHER--
REPL TIMER
COPY M T;  --CYCLE]]

MARK WRITE_END
COPY T F
COPY M T
TJMP WRITE_END

@REP 10
LINK -1
@END
188/72/87 ...which was necessary to keep it inside the size limit.

silentsnack
Mar 19, 2009

Donald John Trump (born June 14, 1946) is the 45th and current President of the United States. Before entering politics, he was a businessman and television personality.

Carbon dioxide posted:

I'm gonna guess this is a vote for the Ember scenes?

ayup

silentsnack
Mar 19, 2009

Donald John Trump (born June 14, 1946) is the 45th and current President of the United States. Before entering politics, he was a businessman and television personality.

Nth Doctor posted:

I haven't started my pay through yet, but I was definitely considering how SWIZ could be used to help get the number of jumps to a book.

both SWIZ X 3 T or DIVI X 100 T would accomplish that.

but if you want an EXA that specifically goes to the right host, instead of just blindly spamming clones, there are multiple ways to go about it. Here's a sample code that only goes to pick up the first file in the list:

code:
GRAB 300
ADDI 300 F X
DROP
MARK LOOP
LINK 800
SUBI X 100 X
DIVI 300 X T
FJMP LOOP
GRAB X
DIVI 300 X T is where the magic happens, though it would be more readable to use "TEST X < 300" because the point is that it returns 0 (to continue LINK-looping) while X>300 but stops when 200<X<299 which means you don't need any additional transformations to get the file's ID#


edit: and as usual some completely unrelated random thing reminded me go back and take another look at the Phage/Heart solution, because it kinda bugged me to have 3 separate control structures redundantly running independent countdowns of the same number. And it turns out the suspicion that there should be a better way was correct, it just required approaching the timer from a different angle. Previous best time was 62/50/45.
code:
;XA
LINK 800

MARK LOOP
DIVI #NERV -10 X
SUBI X 3 T

FJMP SKIP
MARK WAIT
SUBI T 1 T
TJMP WAIT
MARK SKIP

REPL LOOP
REPL B
LINK 1
LINK 1
KILL
COPY 40 #NERV
COPY -70 #NERV
COPY -70 #NERV
JUMP BEAT

MARK B
LINK 3
LINK 3
KILL
COPY -70 #NERV
COPY 40 #NERV
MARK BEAT
COPY -70 #NERV
JUMP BEAT

;XB
NOOP
NOOP
LINK 800
REPL B
LINK 1
LINK 1
COPY 40 #NERV
COPY -70 #NERV
COPY -70 #NERV
JUMP BEAT
MARK B
LINK 3
LINK 3
COPY -70 #NERV
COPY 40 #NERV
MARK BEAT
COPY -70 #NERV
JUMP BEAT
Combined with splitting off the special-case'd first generation into a separate EXA to save a REPL operation brings it down to 56/45/42. Or if we'd prefer a more elegant version we can trade one cycle for basically cutting the script in half:
code:
LINK 800
REPL A
MARK LOOP
DIVI #NERV -10 X
SUBI X 3 T
FJMP SKIP
MARK WAIT
SUBI T 1 T
TJMP WAIT
MARK SKIP

REPL LOOP

MARK A
REPL B
LINK 1
LINK 1
KILL
COPY 40 #NERV
COPY -70 #NERV
COPY -70 #NERV
JUMP BEAT

MARK B
LINK 3
LINK 3
KILL
COPY -70 #NERV
COPY 40 #NERV
MARK BEAT
COPY -70 #NERV
JUMP BEAT
57/29/43

silentsnack fucked around with this message at 23:03 on Apr 6, 2022

silentsnack
Mar 19, 2009

Donald John Trump (born June 14, 1946) is the 45th and current President of the United States. Before entering politics, he was a businessman and television personality.

Carbon dioxide posted:

By the way, now that I got the second zine, here's a full explanation of the @REP macro.


sometimes stupid code is extra stupid... but usually that just means it doesn't work :thunk:

code:
GRAB 301
LINK 800

MARK LOOP
REPL PAYLOAD
COPY 11 T

MARK DIALER
COPY F #DIAL
SUBI T 1 T
TJMP DIALER

COPY 800 M

TEST EOF
COPY -1 #DIAL
FJMP LOOP

MARK PAYLOAD
LINK -1
GRAB 300
COPY F X
COPY F T
DROP

LINK 800
LINK M

GRAB 200
MARK DATA
SEEK -2
COPY X F
COPY T F
COPY F F
JUMP DATA
367/28/26

Nth Doctor posted:

Mass media is a sham and You never know...
e

Nth Doctor posted:

Lol I quoted Junpei and removed the tag for my post.

Guess it would have been funnier to keep the meta-joke going by directly copying instead?

silentsnack fucked around with this message at 02:29 on Apr 10, 2022

silentsnack
Mar 19, 2009

Donald John Trump (born June 14, 1946) is the 45th and current President of the United States. Before entering politics, he was a businessman and television personality.

GuavaMoment posted:

I'm still chasing down one cycle I know is possible, so maybe you all can help?

"depends on which cycle you mean" and/or "maybe you can figure the rest of this mess out" because 23 is feasible with a bit of effort and paying attention to order of operations, so i'm blaming you for this one:

code:
;XA
GRAB 300
COPY F M
SEEK -1
COPY F X
LINK 800
REPL NORTH;B20-B30
LINK 801
MARK NORTH;B21-B31
REPL SOUTH
LINK 800
REPL HERE
WIPE;CRASH

MARK SOUTH;B10,B11
REPL HERE
LINK 802
MARK HERE
GRAB 200
TEST F = X
TJMP YES
SEEK 5
TEST F = X
DIVI T T T
MARK YES
COPY F X
@REP 4
COPY X F
@END

;XB
LINK 800
LINK 801
COPY M X
REPL NORTH
LINK 801
REPL N1;B22-B32
LINK 801
MARK N1;B23-B33
REPL S1
REPL HERE
LINK 800
JUMP HERE

MARK S1;B12,B13
LINK 802
JUMP HERE

MARK NORTH;B41-B43
REPL SOUTH
LINK 800
LINK 800
REPL EAST
MARK WEST;B00,B40
REPL HERE
LINK 803
JUMP HERE

MARK SOUTH;B01-B03
LINK 802
LINK 802
REPL WEST
MARK EAST
LINK 801
REPL HERE
LINK 801

MARK HERE
GRAB 200
TEST F = X
TJMP YES
SEEK 5
TEST F = X
DIVI T T T
MARK YES
COPY F X
@REP 4
COPY X F
@END
23/73/25

and a 22 cycle solution is possible, but I haven't found a way to make it fit inside the solution size limit

code:
;XA
GRAB 300
COPY F X
REPL WEST_X
COPY X M
MARK SEND
COPY X M
COPY X M
HALT

MARK NORTHWEST;B30-B40
LINK 800
REPL HERE
LINK 800
JUMP HERE

MARK WEST_X;B20-B21
REPL SEND
LINK 800
REPL NORTHWEST
REPL SOUTHWEST

REPL HERE
LINK 801
JUMP HERE

MARK SOUTHWEST;B10-B00

LINK 802
REPL HERE
LINK 802

MARK HERE
GRAB 200
TEST F = X
TJMP YES
SEEK 5
TEST F = X
DIVI T T T
MARK YES
COPY F X
@REP 4
COPY X F
@END

;XB
REPL SOUTH
LINK 800
LINK 801
REPL MID_3
LINK 800
COPY M X
;B31-B41
REPL HERE
LINK 800
MARK HERE
GRAB 200
TEST F = X
TJMP YES
SEEK 5
TEST F = X
DIVI T T T
MARK YES
COPY F X
@REP 4
COPY X F
@END
HALT

MARK MID_3;B22
NOOP
NOOP
LINK 801
COPY M X
JUMP HERE

MARK SOUTH;B11-B01
LINK 800
LINK 801
LINK 802
COPY M X
REPL HERE
LINK 802
JUMP HERE

;XC
LINK 800
LINK 801
LINK 801
REPL NORTHEAST
LINK 801
COPY M X
REPL SOUTHEAST
;B33-B43
LINK 800
REPL HERE
LINK 800
GRAB 200
TEST F = X
TJMP YES
SEEK 5
TEST F = X
TJMP YES
HALT

MARK SOUTHEAST;B1X-B0X
LINK 802
REPL HERE
LINK 802
GRAB 200
TEST F = X
TJMP YES
SEEK 5
TEST F = X
TJMP YES
HALT

MARK EAST_X;B23
LINK 801
JUMP HERE

MARK NORTHEAST;B32-B42
COPY M X
REPL EAST_X
REPL SOUTHEAST
LINK 800
REPL HERE
LINK 800
MARK HERE
GRAB 200
TEST F = X
TJMP YES
SEEK 5
TEST F = X
DIVI T T T
MARK YES
COPY F X
@REP 4
COPY X F
@END
22 cycles, 125 lines (so it doesn't count for statistics)


silentsnack
Mar 19, 2009

Donald John Trump (born June 14, 1946) is the 45th and current President of the United States. Before entering politics, he was a businessman and television personality.

Beartaco posted:

I've been playing through the game myself and I never once thought to do this. I'd been storing my index values on X and using repeated TESTs for all of my loops. Much appreciated!

Is this trick mentioned in the Zine anywhere?

I think all the examples use X and they don't outright give you the minimalist loop structure since it's a puzzle game, but the first zine drops a few hints that "TEST operations overwrite whatever value is in the T register ...but it also has the same features as the X register, so you can also read/modify it however you want, and TJMP/FJMP only check whether or not T=0"

silentsnack
Mar 19, 2009

Donald John Trump (born June 14, 1946) is the 45th and current President of the United States. Before entering politics, he was a businessman and television personality.

Entropy always wins eventually, and I guess "business reasons" supposed to be a euphemism for money?

Carbon dioxide posted:

I feel like this might be the right approach to get to the smallest size. There's actually some duplicate code in there. But I can't quite figure out how to get rid of it.
There's a trick we can employ here where we blind-fire a bunch of clones that either crash or accomplish their goal (which requires the solution also has to be slow so it doesn't clog the network) and exploit the known distances between nodes. This lets us use a single script to do everything:
code:
LINK 800
COPY -3 X

MARK INPUT
LINK X
LINK X
COPY #NERV T
MULI X -1 X
LINK X
LINK X
MARK OUTPUT
LINK X
REPL INPUT
LINK X
REPL OUTPUT
COPY T #NERV
JUMP INPUT
274/16/548. Each input/output pair is separated by 4, 6, or 8 jumps (sending output at 2 doesn't work because the P-HND signal also hits M-HND) and to make the cycle hit all 3 inputs without saturating we have to rely on the 5 jumps between M-CNS and H-HND, then it can also go one further to P-HND

Carbon dioxide posted:

Runs at 47/72/24, which is still 10 whole cycles away from the top percentile. Most of it wasted on walking back and forth. I think I can't get any better without involving the M register.

Here we can do some shenanigans that rely on something from the zine: "nerve voltages oscillate around -70mV but can spike up to 50 or down to -120" but here if we look at the testdata M shows all the characteristics but I think this is the first time we've seen sensory nerves like H and P that always stay near -70. Why is that useful? It means they're all 2-digit numbers and always have the same sign, but EXAs can handle 4-digit variables, at which point you can probably guess where this is going...
code:
;XA
LINK 800
LINK -3
LINK -3

MARK M_LOOP
REPL NERV
JUMP M_LOOP

MARK NERV
COPY #NERV X
COPY #NERV T

@REP 4
LINK 3
@END
COPY X #NERV
COPY T #NERV

;XB
;NOOP
LINK 800
LINK 3
LINK 3
LINK 3
REPL HND_LOOP
LINK 3

MARK HND_LOOP
REPL NERV
JUMP HND_LOOP

MARK NERV
MULI #NERV 100 X
ADDI X #NERV M

;XC
;NOOP
;NOOP
LINK 800
LINK -3
LINK -3
LINK -3
REPL CNS_LOOP
LINK -3

MARK CNS_LOOP
NOOP
REPL CNS_LOOP

COPY M X
SWIZ X 43 #NERV;DIV  100
SWIZ X 21 #NERV;MOD -100
25/39/47 if we comment out the NOOPs and just assume the EXAs start moving in order of XA,XB,XC

silentsnack
Mar 19, 2009

Donald John Trump (born June 14, 1946) is the 45th and current President of the United States. Before entering politics, he was a businessman and television personality.

GuavaMoment posted:

silentsnack continues to otherwise kick my rear end.

TBF quite a few times you've posted solutions better optimized than mine, in one stat or another, and it might not have been obvious but in going back through the game I've used some tricks derived from your posts, which I probably never would have thought up on my own. :v:


edit: ...or in some cases we've independently come up with the same technique, like this one

GuavaMoment posted:

Very easy to tweak this to save two cycles - have XA do a file copy of 7 length instead of 14, replicate an exa to do it again, and transfer 7 digits over at a time. It's a little faster because now you have two exas who can read and copy values at the same time instead of one doing everything. 35/56/21

silentsnack fucked around with this message at 01:52 on May 1, 2022

silentsnack
Mar 19, 2009

Donald John Trump (born June 14, 1946) is the 45th and current President of the United States. Before entering politics, he was a businessman and television personality.

Hacking is obviously its own reward if we're already bothering to play a goofy hacking puzzle game :v: / arcade game?

There are a couple of minor tweaks to get the solution smaller the first being to compress the auth sequence so long as the rest of the code to unpack it isn't longer than 12 more lines and/or you can have some parts perform multiple functions.

Also for making the SSEubstitution, there's an order-of-operations rearrangement that lets you can minimize read/seek operations by using internal registers edit: the second one was in fact a file I/O error because i apparently can't count all the way to loving 3 :v:

code:
;XA
LINK 800
COPY 8032 X
MARK AUTH
SWIZ X 4 #AUTH
SWIZ X 3 #AUTH
SWIZ X 2 #AUTH
SWIZ X 1 #AUTH
COPY M X
TEST MRD
TJMP AUTH

MARK READER
REPL WRITER
LINK 801
GRAB M
MARK READ
COPY F M
JUMP READ


MARK WRITER
COPY #TRAK M
MAKE
MARK WRITE_LOOP
COPY M T
COPY T F
TEST T > 0
TJMP SKIP
SEEK -1
COPY X F
MARK SKIP
TEST MRD
TJMP WRITE_LOOP

REPL READER
LINK 800

;XB
GRAB 300
COPY 7104 M
COPY 9512 M
COPY 5260 M
COPY F M
6412/37/62

GuavaMoment posted:

Major speed tips - the files are always multiples of 12, so unroll files into 12 long loops. I transmit the files, then go back through and replace the SSEA code. There's a third timing exa IN LOCAL MODE that exas in the buffer must communicate with first so that long files get done before short files.

Also the longest files are 36 entries, so you only really need at most two EOF checks. And since the file sizes are somewhat predictable, IF we use one way or another to measure how big a file is, we can add a variable delay to make short files wait a bit to make sure they don't get dropped before a previous big file... which at some point requires experimentally finding values that work

code:
;XA
LINK 800
COPY 8 #AUTH
COPY 0 #AUTH
COPY 3 #AUTH
COPY 2 #AUTH
COPY 7 #AUTH
COPY 1 #AUTH
COPY 0 #AUTH
COPY 4 #AUTH
COPY 9 #AUTH
COPY 5 #AUTH
COPY 1 #AUTH
COPY 2 #AUTH
COPY 5 #AUTH
COPY 2 #AUTH
COPY 6 #AUTH

;XB
COPY 6 T
MARK WAIT_AUTH
SUBI T 1 T
TJMP WAIT_AUTH

LINK 800
REPL READER

MARK WRITER;[MAIN LOOP]
MAKE
COPY 24 X     ;(?)
COPY M F;COPY #1/12

MARK W_LOOP
@REP 8
COPY M F;COPY #2~9/12
@END

SUBI X 8 X    ;(??)
COPY M F
TEST X = 0    ;(???)
COPY M F
TJMP SKIP_MRD
COPY M F;COPY #12/12

TEST MRD
FJMP WROTE

COPY M F;#1 OF NEXT LOOP
JUMP W_LOOP; "FREE" JUMP

MARK SKIP_MRD
COPY M F

MARK WROTE
REPL READER
REPL WRITER;[/MAIN LOOP]

LINK 800
MODE
SEEK -999
COPY X T      ;(SOMEHOW)

FJMP DATA
MARK SYNC
SUBI T 1 T
TJMP SYNC     ;(MAGIC?)

MARK DATA
@REP 2
TEST F > 0
TJMP DATA
SEEK -1
COPY M F
@END
JUMP DATA


MARK READER
COPY #TRAK T
LINK 801
GRAB T
MARK READ
@REP 18
COPY F M
@END
JUMP READ

;XC LOW-EFFORT SSEA HACK
GRAB 300
LINK 800
LINK 800
COPY F X
MARK PATCH
COPY X M
JUMP PATCH
2304/99/69 is the fastest I've managed to get without going over size limits, but if we disregard the fact it adds a bunch more lines of code there's another way around the delay, we need to employ some meta knowledge here.

My absolute fastest solution clocks in at 2265/123/1562 and is mostly the same as the 2304 version except for adding this to the end of XA, make XB/READER do @REP 36 x COPY F M and also instead of XB/WRITER and XC doing the patch substitution in the "buffer" node and simply dropping the output file directly where it's needed, they use our home machine for its extra storage space
code:
;XA
LINK 800
COPY 8 #AUTH
[...ETC...]

LINK 800
COPY 400 X
JUMP MOVEIT
MARK NEXT
ADDI M 1 X

MARK MOVEIT
TEST MRD
TJMP NEXT
REPL MOVEIT
LINK -1
LINK -1
GRAB X
LINK 800
LINK 800
COPY X M
Thanks to the fact that the first file you MAKE always has the filename "400" and the next is "401" and so on, dropping and grabbing files can be used as a control variable.

What this version does differently is that it makes the writer patch files as fast as possible and EOF-crash to drop them someplace they won't cause traffic jams and also won't get picked up at the wrong time by the output bot (which is also involved in one of the achievements). The new XA now enters a loop of spamming clones that start in buffer, run back to home to try to grab whatever the next file is supposed to be, and if they're successful they report the success so no matter which order files get finished, XA only picks up the correct one because we know which filename is supposed to come next.

silentsnack fucked around with this message at 23:56 on May 11, 2022

silentsnack
Mar 19, 2009

Donald John Trump (born June 14, 1946) is the 45th and current President of the United States. Before entering politics, he was a businessman and television personality.

Jade Rider posted:

It's complicated and Better is subjective.
:effort:

GuavaMoment posted:

I know 17 cycles is possible though. (.....) My lowest size is 25, and I know 21 is possible.

once again I'm blaming you for making me do this. because that's definitely a reasonable thing to do. also because it was easier to copypaste and tweak your code than to untangle my previous 19 cycle kludge
code:
GRAB 300
COPY F X
COPY F T
LINK 800
REPL COLUMN3
REPL COLUMN2
REPL COLUMN1
REPL SOUTH
REPL NORTH
REPL TEST
LINK 800
WIPE
REPL BSIDE
HOST T
TEST T = X
DIVI 0 T #POWR

MARK COLUMN3
LINK 801
MARK COLUMN2
LINK 801
MARK COLUMN1
LINK 801
REPL SOUTH
REPL NORTH
REPL TEST
LINK 800

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


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


MARK NORTH
LINK 800
LINK 800

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


code:
GRAB 300
LINK 800
LINK 800
LINK 800
COPY F X
COPY F T
WIPE

MARK A
REPL B
LINK 801
JUMP A

MARK BB
LINK 802
MARK B
REPL BB

REPL C
COPY T X
MARK C
HOST T
TEST T = X
SUBI 1 T #POWR
32/21/22 (edited to add linebreaks for readability)

silentsnack fucked around with this message at 14:48 on May 26, 2022

silentsnack
Mar 19, 2009

Donald John Trump (born June 14, 1946) is the 45th and current President of the United States. Before entering politics, he was a businessman and television personality.

Similar to the Wonderdisc puzzle, we can reduce cycles for logic-jumps by @REPing some of the slowest and most repetitive processing

code:
;XA
LINK 800
GRAB 199

@REP 10
COPY F T
REPL DO_STUFF
@END

MARK DO_STUFF
GRAB T
SEEK 1
ADDI F F X
ADDI X F X
DIVI X 3 X
MULI F F T
DIVI T F T
ADDI X T X
SUBI F F T
MULI T 20 T
ADDI X T X
TEST X > 341
DIVI X T M
MODE
SEEK -9
COPY F M


;XB
LINK 800
MAKE
COPY M X
MODE
JUMP COPY

MARK MAX
SEEK -2
MARK COPY
COPY M F
COPY X F
MARK NEXT
@REP 3
MODE
SEEK -1
COPY M X
TEST X > F
MODE
TJMP MAX
VOID M
@END
JUMP NEXT


;XC
COPY 34 T
MARK WAIT
SUBI T 1 T
TJMP WAIT
LINK 800
NOOP
KILL
KILL
KILL
GRAB 400
LINK -1
SEEK 1
VOID F
79/85/7 also i guess there's that check vs trial-and-error 341 to skip processing low scores?

As for size optimization, what if we compared scores directly instead of sending a bunch of busywork transmissions and VOIDing them?
code:
;XA -- LOCAL
LINK 800
GRAB 199

MARK ARTICHOKE
COPY F T
REPL BROCCOLI
JUMP ARTICHOKE

MARK DISJUNCTION
MODE
COPY F M

MARK BROCCOLI
GRAB T
SEEK 1
ADDI F F X
ADDI X F X
DIVI X 3 X
MULI F F T
DIVI T F T
ADDI X T X
SUBI F F T
MULI T 20 T
ADDI X T X

MARK CHIPOTLE
COPY X M
SEEK -9
TEST MRD
FJMP DISJUNCTION
TEST X > M
TJMP CHIPOTLE


;XB -- GLOBAL
MAKE
COPY M F

;XC -- LOCAL
LINK 800
VOID M
110/32/2


berryjon posted:

You'd Be Smarter than that
Losers

silentsnack fucked around with this message at 20:45 on Jun 4, 2022

silentsnack
Mar 19, 2009

Donald John Trump (born June 14, 1946) is the 45th and current President of the United States. Before entering politics, he was a businessman and television personality.

GuavaMoment posted:

No one on my friends list has a faster time, and one person ties me on lines, so this might be a time I can best silentsnack. There's one catch though - two friends have 24 for activity, and I'm not sure how that's possible. As you've tried to do!

Yeah my best scores were 28 cycles and 22 lines, and my fast solution is mostly similar except significantly less efficient due to laziness and aiming for a goofy solution gif :v:

silentsnack
Mar 19, 2009

Donald John Trump (born June 14, 1946) is the 45th and current President of the United States. Before entering politics, he was a businessman and television personality.

small solution
code:
;XA
GRAB 300
LINK 800
LINK 799
VOID F
COPY F X

LINK 800
MARK A_LOOP
SUBI X #AZIM T
COPY T #MOTR
TJMP A_LOOP
LINK -1

VOID F
COPY F X
VOID F
COPY F #FREQ
WIPE

LINK 801
MARK E_LOOP
SUBI X #ELEV T
COPY T #MOTR
TJMP E_LOOP
VOID M

;XB
LINK 800
COPY 0 M
MARK KEY_RESET
GRAB 199
MARK KEY_LOOP
SUBI F 5000 X
SUBI X 5000 X
REPL CODEC
JUMP KEY_LOOP


MARK CODEC
LINK -1
GRAB 301
VOID F
ADDI X F X
DROP
LINK 800
REPL KEY_RESET

LINK 799
TEST X < 0
MULI T 5000 T
ADDI X T X
ADDI X T #DATA
327/44/102

fast solution:
code:
;XA- MY AZIMUTH CAN'T BE
;THE RATE-LIMITNG STEP
LINK 800
LINK 799
LINK 800
COPY M X
MARK A_LOOP
@REP 8
SUBI X #AZIM #MOTR
@END
TEST X = #AZIM
FJMP A_LOOP

;XB- I GOT SENT TO THE
;UPLINK HOST AND NOW I'M
;STUCK BUFFERING OUTPUT
GRAB 300
VOID F
COPY F M
LINK 800
LINK 799

COPY 15 T
REPL DATA

VOID F
COPY F X
VOID F
COPY F #FREQ
WIPE
LINK 801
MARK E_LOOP
SUBI X #ELEV #MOTR
SUBI X #ELEV T
MODI 1 T #MOTR
JUMP E_LOOP


MARK DATA
MODI -2 T T
MAKE
COPY M F
COPY M F
FJMP LAST
COPY M F
REPL DATA

MARK WAIT_ALIGN
SUBI T 1 T
TJMP WAIT_ALIGN

SEEK -3
@REP 3
COPY F #DATA
@END
WIPE

MARK LAST
SEEK -2
@REP 2
COPY F #DATA
@END
WIPE
COPY M #DATA

;XC- LET'S TRANSMIT THE
;DATA IMMEDIATELY!!
GRAB 301
LINK 800
VOID F
MARK READ_LOOP
@REP 3
ADDI F M X; LOCAL
REPL ENCODE
@END
JUMP READ_LOOP

MARK ENCODE
LINK -1
TEST X < 0
MULI T 5000 T
ADDI X T X
MODE
ADDI X T M;GLOBAL

;XD- DO  STUPID SELF-
;-REFERENCING JOKES
;DREAM OF BREAKING
;THE FOURTH WALL?
LINK 800
REPL START

COPY 33 T
MARK WAIT_CLEANUP
SUBI T 1 T
TJMP WAIT_CLEANUP
KILL
KILL
KILL
KILL
GRAB 301
LINK -1
HALT

MARK KEY_OUT
SUBI X 5000 M;LOCAL
;GRAB?? OR CRASH
MARK START
GRAB 199
SUBI F 5000 X
MARK KEY_LOOP
@REP 3
REPL KEY_OUT
SUBI F 5000 X
@END
JUMP KEY_LOOP
81/99/37


Quackles posted:

Hacking those ATMs was your idea, Ember. And I'm not sure I understood it.

silentsnack fucked around with this message at 20:57 on Jun 19, 2022

silentsnack
Mar 19, 2009

Donald John Trump (born June 14, 1946) is the 45th and current President of the United States. Before entering politics, he was a businessman and television personality.

GuavaMoment posted:

I had a 60 cycle solution I was playing with last week, but it's gone? I must have done something and accidentally deleted it. I remade at least it but with more lines somehow? 50 cycles is possible.

I've accidentally deleted a solution when I was trying to make a copy to experiment with several times, but luckily if you find the savegame directory (under My Documents on winders) there's also a 'deleted' folder which does what you might expect.

It's tough to optimize size since it requires making tradeoffs, like if you write "300" before scanning the account list you don't need to TEST EOF which means you can use the T register for storage, but it requires SEEK
code:
;XA
GRAB 300
COPY F X

LINK 800
LINK 800
REPL DIRECTORY
COPY M X
SEEK 99
MODE
MARK DEPOSIT
COPY M F
COPY X F
COPY 1 F
COPY 0 F
TEST MRD
TJMP DEPOSIT
KILL

MARK WITHDRAW
GRAB M
MODE
COPY F M
SEEK 99
COPY X F
COPY T F
COPY 1 F
COPY 0 F

MARK DIRECTORY
GRAB 199
SEEK 99
COPY 300 F
SEEK -99
COPY M T
MARK INDEX
REPL WITHDRAW
COPY F M
NOOP
JUMP INDEX

;XB
GRAB 301
COPY F M
COPY F M
66/39/3

As for low-cycle solution, sending the number from accounts making withdrawals can be parallelized but at some point the JUMP operation in the file300 write routine imposes a speed bottleneck, so it's possible to save a few cycles by partially unrolling that loop.
code:
;XA
LINK 800
LINK 800
GRAB 199
COPY M X;GET OUR ID#

MARK INDEX
COPY F T
REPL WITHDRAW
TEST EOF
FJMP INDEX

COPY 300 F
@REP 6
NOOP
@END
KILL
HALT

MARK PWN
MODE
COPY T M;SEND THEIR ID#
;THEN CRASH

MARK WITHDRAW
GRAB T
COPY F T
REPL PWN
SEEK 99
COPY X F
COPY M F;GET "DEBIT"
COPY 1 F
COPY 0 F

;XB
GRAB 300
LINK 800
LINK 800
COPY M X;GET "CREDIT"
COPY F M;SEND OUR ID#
MODE
SEEK 99
MARK DEPOSIT
@REP 4
COPY M F;GET THEIR ID#
COPY X F
COPY 1 F
COPY 0 F
@END
JUMP DEPOSIT

;XC
GRAB 301
COPY F M;SEND "CREDIT"

COPY F X
COPY 17 T
REPL TIMER

MARK WHAT
COPY X M;SEND "DEBIT"
JUMP WHAT

MARK TIMER
SUBI T 1 T
TJMP TIMER
KILL
47/67/6

silentsnack
Mar 19, 2009

Donald John Trump (born June 14, 1946) is the 45th and current President of the United States. Before entering politics, he was a businessman and television personality.

code:
GRAB 300

MARK DIAL_LOOP
COPY F X
REPL PHONE
SEEK -1
VOID F
NOOP
MARK COPY_LOOP
SEEK -9999
TEST MRD
FJMP DIAL_LOOP

COPY -1 F
SEEK 9999
COPY M F
JUMP COPY_LOOP

MARK PHONE
LINK 800
COPY X #DIAL
LINK 800
GRAB 200
MARK READ
COPY F M
JUMP READ
3879/23/272



GuavaMoment posted:

The "Area code" (472) is always the same so you can skip some of the digits of phone numbers. That's the only serious change I think, it's a pretty straightforward challenge.
thought about that but didn't manage to get anywhere with it

code:
;XA - GLOBAL
GRAB 300
LINK 800
JUMP START

MARK SUCCESS
MODE      ;LAZY HACK
VOID M    ;BUT IT WORKS?

MARK READER
GRAB 200
MARK READ
SEEK 1
COPY F M
@REP 5
MULI F 10 X
ADDI X F M
@END
JUMP READ

MARK MAIN_LOOP
ADDI X 11 X
GRAB 300
MARK START
SEEK X

@REP 11
COPY F #DIAL
@END

REPL MAIN_LOOP
LINK 800
REPL READER
LINK -1
REPL SUCCESS
SEEK 9999
MARK WRITE
COPY M F
@REP 5
COPY M T
SWIZ T 2 F
SWIZ T 1 F
@END
TEST MRD
TJMP WRITE

REPL MAIN_LOOP
COPY -1 #DIAL

;XB - LOCAL
LINK 800
@REP 8    ;SUCCESS COUNT
COPY 0 M 
@END

KILL      ;CLEANUP
GRAB 300
LINK 800
KILL
WIPE
775/79/21

going with "Is it going to be enough?" and "Nothing about this is normal"

silentsnack fucked around with this message at 22:06 on Jul 9, 2022

silentsnack
Mar 19, 2009

Donald John Trump (born June 14, 1946) is the 45th and current President of the United States. Before entering politics, he was a businessman and television personality.

GuavaMoment posted:

After receiving a signal over M, create 5 exas, one for each centrifuge. Test to see if your centrifuge has the highest pressure, otherwise die. Yes, there's only room for 4 exas, but one will die soon enough for the 5th to enter the testing room. Then go turn off your centrifuge and send a done signal. 136/97/22. My low line is, uh, 86, so I don't think I've ever tried very hard at making one. 44 is the best low line among my friends, so good job on that! For all you wizards, get a solution down to 54 cycles. Somehow.
It's possible to save a lot of code if you reuse lines, and still end up running quickly. This time around I haven't optimized all that much getting the solutions working to implement whichever ideas I was going for.

Like the fact that the hardware registers are so annoying here's a solution that only includes one instance of ["#ZGC"]
code:
LINK 800
MARK MAIN_LOOP
LINK 799
MAKE
@REP 5
COPY #ZGC@{0,1} F
@END
LINK -1
LINK 798

MARK MAX
SEEK -1
COPY F X
SEEK -5
MARK PARSE
TEST F > X
TJMP MAX
TEST EOF
FJMP PARSE

SEEK -5
MARK FORWARD
TEST F = X
TJMP STOP
LINK 800
JUMP FORWARD

MARK STOP
WIPE
DIVI 0 X #POWR
MARK REVERSE
LINK -1
REPL REVERSE
JUMP MAIN_LOOP
374/33/49


Also here's one that's really suboptimal, it's just about the point in going for speed where I quit trying to do anything elegant or clever and just aimed for something that works
code:
;XA
LINK 800
LINK 799
MARK 0
TEST #ZGC1 < #ZGC0
FJMP 1
TEST #ZGC2 < #ZGC0
FJMP 2
TEST #ZGC3 < #ZGC0
FJMP 3
TEST #ZGC4 > #ZGC0
MULI T 4 T
ADDI 7 T M
ADDI T 1 T
JUMP WAIT

MARK 1
TEST #ZGC2 < #ZGC1
FJMP 2
TEST #ZGC3 < #ZGC1
FJMP 3
TEST #ZGC4 > #ZGC1
MULI T 3 T
ADDI 8 T M
ADDI T 1 T
JUMP WAIT

MARK 2
TEST #ZGC3 < #ZGC2
FJMP 3
TEST #ZGC4 > #ZGC2
MULI T 2 T
ADDI T 9 M
ADDI T 2 T
JUMP WAIT

MARK 3
TEST #ZGC4 > #ZGC3
ADDI T 10 M
ADDI T 3 T

MARK WAIT
SUBI T 1 T
TJMP WAIT
JUMP 0

;XB
COPY 5 X
LINK 800
LINK 798

MARK LOOP
MODI -1 X X
COPY M T
REPL LOOP

MODI T 7 #POWR
LINK 800
MODI T 8 #POWR
LINK 800
MODI T 9 #POWR
LINK 800
MODI T 10 #POWR
LINK 800
MODI T 11 #POWR

;XC
COPY 40 T
MARK WAIT
SUBI T 1 T
TJMP WAIT
LINK 800
LINK 799
KILL
95/63/27 and you might note that it applies a few tricks I copied from some of your earlier solutions


code:
;XA
LINK 800
LINK 799
COPY 3 X
MARK 0
TEST #ZGC1 < #ZGC0
FJMP 1
TEST #ZGC2 < #ZGC0
FJMP 2
TEST #ZGC3 < #ZGC0
FJMP 3
TEST #ZGC4 > #ZGC0
MULI T 4 T
REPL NEXT

LINK -1
LINK 798
COPY T #POWR
LINK 800
LINK 800
LINK 800
LINK 800
SUBI 4 T #POWR
HALT

MARK 1
TEST #ZGC2 < #ZGC1
FJMP 2
TEST #ZGC3 < #ZGC1
FJMP 3
TEST #ZGC4 > #ZGC1
MULI T 3 T
REPL NEXT

LINK -1
LINK 798
LINK 800
COPY T #POWR
LINK 800
LINK 800
LINK 800
SUBI 3 T #POWR
HALT

MARK 2
TEST #ZGC3 < #ZGC2
FJMP 3
TEST #ZGC4 > #ZGC2
MULI T 2 T
REPL NEXT

LINK -1
LINK 798
LINK 800
LINK 800
COPY T #POWR
LINK 800
LINK 800
SUBI 2 T #POWR
HALT

MARK 3
TEST #ZGC4 > #ZGC3
ADDI T 2 T
REPL NEXT

LINK -1
LINK 798
LINK 800
LINK 800
LINK 800
MODI 2 T #POWR
LINK 800
MODI 3 T #POWR
HALT

MARK NEXT
MODI -1 X X
ADDI T 1 T
MARK WAIT
SUBI T 1 T
TJMP WAIT
JUMP 0

;XB
COPY 22 T
LINK 800
LINK 798
REPL WAIT

MARK UGH
LINK 800
SUBI T 1 T
REPL UGH

MARK WAIT
NOOP
SUBI T 1 T
TJMP WAIT

COPY 0 #POWR
75/87/32 I figure 75 cycles is close enough. Maybe you can shave off another cycle somewhere, i'm done

silentsnack
Mar 19, 2009

Donald John Trump (born June 14, 1946) is the 45th and current President of the United States. Before entering politics, he was a businessman and television personality.

GuavaMoment posted:

No thanks. Tthough I do like the UGH branch. That does make a lot of sense - find out what your slowest solution for turning off 4 centrifuges are, then turn everything off one cycle after.

welp, that's okay anyway because apparently I was wrong. friday night a couple weeks later is obviously the perfect time for brain to decide I'm not allowed to sleep until I take another swing at this, because there was a bunch of useless/wrong junk code left in that 75 cycle solution from earlier attempts.

after deleting the delay-juggling cruft it ended up going from 75/87/32 to 68/82/40 but then had some terrible ideas that I will unapologetically inflict on the universe:
code:
;XA
LINK 800
LINK 799

;BEHOLD! SPAGHETTI!
MARK 0
TEST #ZGC1 < #ZGC0
FJMP 1
TEST #ZGC2 < #ZGC0
FJMP 2
TEST #ZGC3 < #ZGC0
FJMP 3
TEST #ZGC4 > #ZGC0
REPL KILL_0
FJMP WAIT1
JUMP WAIT5

MARK 1
TEST #ZGC2 < #ZGC1
FJMP 2
TEST #ZGC3 < #ZGC1
FJMP 3
TEST #ZGC4 > #ZGC1
REPL KILL_1
FJMP WAIT2
JUMP WAIT5

MARK 2
TEST #ZGC3 < #ZGC2
FJMP 3
TEST #ZGC4 > #ZGC2
REPL KILL_2
FJMP WAIT3
JUMP WAIT4

MARK 3
TEST #ZGC4 > #ZGC3
REPL KILL_3
FJMP WAIT4
NOOP

;LOOKING SILLY ENOUGH?
MARK WAIT5
NOOP
MARK WAIT4
NOOP
MARK WAIT3
NOOP
MARK WAIT2
NOOP
MARK WAIT1
NOOP
JUMP 0

;WHY
MARK KILL_0
LINK -1
LINK 798
COPY T #POWR
LINK 800
LINK 800
LINK 800
LINK 800
DIVI 0 T #POWR

MARK KILL_1
LINK -1
LINK 798
LINK 800
COPY T #POWR
LINK 800
LINK 800
LINK 800
DIVI 0 T #POWR

MARK KILL_2
LINK -1
LINK 798
LINK 800
LINK 800
COPY T #POWR
LINK 800
LINK 800
DIVI 0 T #POWR

MARK KILL_3
LINK -1
LINK 798
LINK 800
LINK 800
LINK 800
COPY T #POWR
LINK 800
DIVI 0 T #POWR

;XB
LINK 800
COPY 16 T
REPL CASCADE

;SWITCHBOARD CLEANUP
LINK 799
JUMP WAIT

;WIPE UR CENTRIFUGES
MARK CASCADE
LINK 798
NOOP
REPL WAIT

MARK UGH
LINK 800
SUBI T 1 T
REPL UGH

MARK WAIT
NOOP
SUBI T 1 T
TJMP WAIT

KILL
COPY 0 #POWR
62/100/40

silentsnack
Mar 19, 2009

Donald John Trump (born June 14, 1946) is the 45th and current President of the United States. Before entering politics, he was a businessman and television personality.

berryjon posted:

There's something about this latest challenge that seems more by-the-numbers. It's not that standout or offers any technically interesting, just gathering numbers and sending them on their way.

Sorta depends on what you're going for? Like if you're going out of your way to optimize for the fastest possible solution or whatever, the more (and more diverse) moving parts a program has the trickier it can be to keep parallel operations working in sync without adding too much extra overhead. But if all you're doing is bashing out any solution that solves the puzzle and moving on, yeah you can just keep doing what you've been doing before and gradually extending it without needing to get inventive and rely on structures where timing doesn't matter since each operation waits for the other to complete before continuing.

Both are equally valid and especially for a first-playthrough where you don't have an audience, quick and dirty is good enough

code:
LINK 800
LINK 1
LINK 3

REPL A
MARK LOOP
COPY 8 T

SUBI M 15 X
MARK DATA
SUBI T 1 T
ADDI X M X
TJMP DATA

MULI X 5 #NERV
REPL LOOP

MARK A
LINK -3
REPL A

LINK -1

MARK B
DIVI -54 #NERV M
LINK 1
JUMP B
944/21/393 In this one you can see race-condition issues in action as the DATA loop receives signals in an unpredictable order while the other senders are stuck waiting. But this time the specific order doesn't matter since 1+0 = 0+1 so random order has no impact on the final value.

code:
;XA
LINK 800
LINK 1
LINK 3

MARK DATA
SUBI M 75 X
@REP 4
ADDI X M X
@END
ADDI X M #NERV
JUMP DATA

;XB
LINK 800
REPL LOOP
LINK -3
REPL LOOP
LINK -3

MARK LOOP
REPL SWEEP
NOOP
DIVI -54 #NERV X
MULI X 5 M
NOOP
NOOP
JUMP LOOP

MARK SWEEP
LINK 1
DIVI -54 #NERV T
LINK 1
DIVI -54 #NERV X
ADDI X T X
MULI X 5 M
245/31/187

silentsnack
Mar 19, 2009

Donald John Trump (born June 14, 1946) is the 45th and current President of the United States. Before entering politics, he was a businessman and television personality.

One optimization is after a successful test showing we have 16 consecutive digits that are all [0~9], if we move to the next set in the file we already know that 15 of its 16 digits have passed the "F = -9999?" test so we only need to test the newest digit. If you're searching forward then that means after reading the 16th value the next one in the file needs to be -9999?'d then you jump back 16. if you're searching backward from the end then it's even more straightforward :dadjoke: but ... uh, we'll get to that later.

Or for a low-line solution, we can replace the whole first-pass -9999? test with two lines, so long as we use a tweaked algorithm that produces a final checksum that is negative IFF any one of its digits is negative.
code:
;XA [LOCAL]
LINK 800
LINK 802
LINK 799
GRAB 199

MARK MAIN_LOOP
SEEK -15
COPY 8 T
COPY 0 X
MARK CRUNCH16
REPL ODD
MULI F 2 M
ADDI X F X
SUBI T 1 T
ADDI X M X
TJMP CRUNCH16

TEST X < 0
TJMP MAIN_LOOP
MODI X 10 T
TJMP MAIN_LOOP

SEEK -16
MODE

MARK SEND
COPY F M
DIVI 1 M T
JUMP SEND

MARK ODD
COPY M X
TEST X > 9
MULI T -9 T
ADDI X T M

;XB [GLOBAL]
MAKE
COPY 16 T
MARK RECEIVE
SUBI T 1 T
COPY M F
COPY T M
TJMP RECEIVE
12293 (lmao)/37/3 As you see we don't test individual digits to see if they're -9999, because it just takes 2 lines to test whether the final X<0 which can be tested independently of MODI X 10 T.

Also as you suggested it a solution can handle a lot of stuff over the M register which ends up being faster since we can freely overwrite the X/T registers of a clone and then let it crash which avoids having to read the file twice with a SEEK -1 between.

Even with parallelization, fast solutions start hitting a limit around 1500 cycles without looking at the comparison at the end that shows individual times to solve each different run of the puzzle, but once again if you start from the end and search backward most testruns end up being fairly fast (indicating the valid credit card numbers are mostly toward the latter half of the file) but several end up taking much longer.

One way to do this is to make a separate copy of the beginning of the garbage file, like in this example exactly the first 100 entries, and check that independently while another EXA starts at position 85 to catch the overlap.
code:
;XA [LOCAL]
LINK 800
LINK 802
LINK 799
GRAB 199
LINK -1
REPL CLONEFILE
COPY 10 T
MARK COPYLOOP
@REP 10
COPY F M
@END
SUBI T 1 T
TJMP COPYLOOP
SEEK -15
JUMP RESET


MARK CLONEFILE
MAKE
COPY 50 T

MARK PASTELOOP
COPY M F
SUBI T 1 T
COPY M F
TJMP PASTELOOP
LINK -1
LINK -1

SEEK -9999

MARK RESET
@REP 16
TEST F < 0
TJMP RESET
@END

MARK CRUNCH16
SEEK -16

MULI F 2 X;#1
REPL ODD1
COPY F T  ;#2

@REP 6
MULI F 2 X;#3,5,7...
REPL ODD2
ADDI F T T;#4,6,8...
@END

MULI F 2 X;#15
REPL ODD1
ADDI F T T;#16

ADDI T M T
ADDI T M T
MODI T 10 T

FJMP DONE

TEST F < 0
FJMP CRUNCH16
JUMP RESET

MARK ODD1
SWIZ X 2 T
SWIZ X 1 X
ADDI X T M
HALT

MARK ODD2
SWIZ X 2 T
ADDI T M T
SWIZ X 1 X
ADDI X T M

MARK DONE
SEEK -16
MODE
@REP 16
COPY F M
@END
REPL CLEANUP
LINK 799

MARK CLEANUP
LINK 800
LINK 802
@REP 4
KILL
@END
GRAB 199
LINK 799

;XB [GLOBAL]
COPY 8 T
MAKE
MARK WRITE
COPY M F
SUBI T 1 T
COPY M F
TJMP WRITE
1197/146/13 and if you note the SWIZ operations are just there for weirdness since "MODI X 10 T ... DIVI X 10 X ... ADDI X T M" produces the same output as SWIZ X 2 T, SWIZ X 1 T, ADDI X T M" and either way both of those take the same number of lines as"TEST X > 9 ... MULI T -9 T ... ADDI X T M"

The fastest solution I've managed searches backward from the end and instead of copying the file it handles the slowest/earliest cases with a goofy hack that takes advantage of the fact that testdata for each run can apparently be uniquely identified by the first 3 digits of the garbage file.
code:
;XA [LOCAL]
LINK 800
LINK 802
LINK 799
GRAB 199
LINK -1

MULI F 100 T
MULI F 10 X
ADDI X F X
ADDI X T X

REPL CASE73
REPL CASE37
REPL CASE97
REPL CASE11
REPL CASE44
REPL CASE14
REPL CASE53
SEEK 9999
SEEK -16
TEST MRD
FJMP START
SEEK M
JUMP START

MARK CASE73; #=8917...
TEST X = 824
DIVI -128 T M
MARK CASE37; #=2454...
TEST X = 292
DIVI -85 T M
MARK CASE97;#=7231...
TEST X = -9409
DIVI -132 T M
MARK CASE11;#=4043...
TEST X = 980
DIVI -101 T M
MARK CASE44;#=8955...
TEST X = -9197
DIVI -142 T M
MARK CASE14;#=4892...
TEST X = 466
DIVI -152 T M
MARK CASE53;#=7921...
TEST X = 644
DIVI -110 T M

MARK RESET
SEEK -17
MARK START
MULI F 2 X;FIRST # OF 16
TEST X < 0
TJMP RESET

@REP 15
TEST F < 0
TJMP RESET
@END
SEEK -15

MARK CHECK
;MULI F 2 X~~WAS HERE
REPL ODD1
ADDI T F T

@REP 6
MULI F 2 X
REPL ODD2
ADDI T F T
@END

MULI F 2 X
REPL ODD1
ADDI T F T

ADDI T M T
ADDI T M T
MODI T 10 T

FJMP DONE

SEEK -17
;FIRST # OF NEXT 16
MULI F 2 X
TEST X < 0
FJMP CHECK
JUMP RESET

MARK ODD1
DIVI X 10 T
MODI X 10 X
ADDI X T M
HALT

MARK ODD2
DIVI X 10 T
ADDI T M T
MODI X 10 X
ADDI X T M
;HALT

MARK DONE
SEEK -16
MODE
@REP 16
COPY F M
@END
LINK 799

;XB [GLOBAL]
COPY 8 T
MAKE
MARK WRITE
COPY M F
SUBI T 1 T
COPY M F
TJMP WRITE
1082/150/5 ... and here's the point where I say I'm not totally out of energy and giving up, simply choosing to leave figuring out how to parse this insane gibberish code as an exercise for especially bored readers. :v:

berryjon posted:

Could use some work
Nah

silentsnack
Mar 19, 2009

Donald John Trump (born June 14, 1946) is the 45th and current President of the United States. Before entering politics, he was a businessman and television personality.

Ember isn't getting progressively more ominous at all, is she?

NHO posted:

Good Conversation?
and What did you do?




A couple of test cases have 6 files to return, which creates a limitation in fast solutions in that you might run out of space for clones which can stall REPL spamming and throw the solution out of sync. My fastest solution uses 5 parallel search EXAs but one of them actually sits in host П-0004 generating clones which then link to П-9999 to try grabbing a file.

code:
;====XA====
COPY 20 T
COPY 200 X
@REP 4
LINK 800
@END
REPL UHH
ADDI X 40 X
MARK UHH
REPL WAT
ADDI X 20 X
MARK WAT
NOOP
NOOP
LINK 800

MARK LOOP
MODI -1 T T
REPL LOOP
ADDI X T X

GRAB X
@REP 5
LINK -1
@END

;====XB====
@REP 5
LINK 800
@END
@REP 6
KILL
@END
COPY 4 T
MARK TIMERS
LINK -1
MODI -1 T T
REPL TIMERS
ADDI T 15 T

MARK WAIT
SUBI T 1 T
TJMP WAIT
KILL
KILL

;====XC====
COPY 20 T
COPY 280 X
NOOP
NOOP
NOOP
@REP 4
LINK 800
@END

MARK LOOP
MODI -1 T T
REPL LOOP
ADDI X T X

LINK 800
GRAB X
@REP 5
LINK -1
@END
65/67/86

Though now that I think about it differently, maybe it would have been faster just to special-case grabbing one or two files from the biggest tests to make room, but whatevs I'm satisfied with 65 cycles


And for small, it's another case where we can make a single loop do everything, in exchange for taking far longer to run.
code:
@REP 5
LINK 800
@END
COPY 304 T

MARK LOOP
SUBI T 1 T
FJMP OUT
KILL
REPL LOOP

GRAB T

MARK OUT
LINK -1
TJMP OUT;RETURN LOOP

;CLEANUP PASS
REPL OUT
KILL
KILL
1238/18/354

It uses a single variable to countdown grab attempts from file 304 (which doesn't exist, but makes sure we get a few more KILL instructions before it tries to grab 299) all the way down to 0 (wasting cycles on another 199 attempts for nonexistent files) before the search hits 0 and triggers the logic to KILL all the remaining EXAs in the network.

silentsnack
Mar 19, 2009

Donald John Trump (born June 14, 1946) is the 45th and current President of the United States. Before entering politics, he was a businessman and television personality.

heh


bewilderment posted:

You've gotta be making GBS threads me.

:hmmyes:


for optimizations, from the histograms it looks like 32 lines should be possible, maybe 31, but the best i've managed is 33


code:
GRAB 301

MARK MAIN_LOOP
ADDI X 5 X
ADDI F 1 T
REPL DATA
MODI X 55 T
TJMP MAIN_LOOP


COPY 26 T
MARK WAIT_TRANSFER
SUBI T 1 T
TJMP WAIT_TRANSFER

REPL DIAL; *DISCO*
JUMP MAIN_LOOP

MARK DATA
REPL DIAL
GRAB 300
MARK READ
COPY F M
JUMP READ

MARK DIAL
LINK 800
SUBI T 1 #DIAL
LINK 800
MARK PRINT
COPY M #DATA
NOOP
TEST MRD
TJMP PRINT

SUBI 441 X T
MARK COUNTDOWN
SUBI T 1 T
TJMP COUNTDOWN
COPY 0 #PAGE
884/33/104

fast solution isn't too mind-blowing, mostly splitting functions for parallelization with hard-coded delays so that the variable message length doesn't break loop synchronization
code:
;XA MODEM AND TIMING
GRAB 301
LINK 800
MARK LOOP
@REP 11
COPY F #DIAL
@END

TEST EOF
REPL TIMER

SUBI 1 T T;LOGIC FLIP
MULI T 9 T;EOF=0 ELSE=9
TJMP WAIT_DATA
WIPE
HALT

MARK WAIT_DATA
SUBI T 1 T
TJMP WAIT_DATA

SUBI X 18 X
JUMP LOOP


MARK TIMER
LINK 800
TJMP LAST;EOF=TRUE
ADDI X 125 T
MARK WAITIMER
SUBI T 1 T
TJMP WAITIMER
NOOP
MARK LAST
COPY 0 #PAGE


;XB TRANSMIT MESSAGE
GRAB 300
LINK 800
JUMP START

MARK HANGUP
COPY -1 #DIAL
MARK START
ADDI X 1 X
SEEK -99
LINK M;WAIT FOR SYNC
@REP 8
COPY F #DATA
@END

MARK DATA
COPY F #DATA
TEST EOF
FJMP DATA

LINK -1

MODI X 8 T
TJMP HANGUP
WIPE


;XC TIMING (XB) CONTROL
LINK 800
MARK LOOP
COPY 5 T
MARK WAIT_DIAL
SUBI T 1 T
TJMP WAIT_DIAL

COPY 800 M

ADDI X 1 X;DO 8 TIMES
MODI X 8 T
DIVI T T T;THEN CRASH

COPY 9 T
MARK WAIT_DATA
SUBI T 1 T
TJMP WAIT_DATA

JUMP LOOP
291/76/27

silentsnack fucked around with this message at 16:44 on Sep 25, 2022

Adbot
ADBOT LOVES YOU

silentsnack
Mar 19, 2009

Donald John Trump (born June 14, 1946) is the 45th and current President of the United States. Before entering politics, he was a businessman and television personality.

You can speed things up a bit by initially collecting only the hostnames and using a shortened sorting method that only takes the lowest value instead of bothering with reordering the list each time; while that sort routine searches for the next host ID, a separate EXA builds the actual output file by retrieving the #NERV value from each host in sequence.
code:
REPL TRAVERSE
MAKE
@REP 12
NOOP
@END


MARK LIST_NODES
COPY M F
ADDI X 1 X
TEST MRD
TJMP LIST_NODES

MODE
REPL COMPILER
SEEK -999
JUMP SORT

MARK NEXT
NOOP
GRAB 400;GRAB SUCCESS?
COPY X M;SMALLEST HOST#
MARK SORT
COPY F X

SEEK -1
VOID F
MARK COMPARE
@REP 6
REPL NEXT;EOF=CRASH
TEST F > X
TJMP COMPARE
SEEK -1
COPY F T
SEEK -1
COPY X F
COPY T X
@END
JUMP COMPARE


MARK COMPILER
MAKE
COPY X T;NODE COUNT
MARK DATA
COPY M X;HOST# FROM SORT
MODE
REPL TRAVERSE
SUBI T 1 T
COPY X F
COPY M F;NERV DATA
MODE
TJMP DATA
HALT


MARK TRAVERSE
LINK 800
REPL 11
REPL HOST

MARK 7A
REPL 13
MARK 7
LINK -3
REPL 7
REPL 9A
JUMP HOST

MARK 9A
REPL 11
MARK 9
LINK -1
REPL 7A
REPL 9
JUMP HOST

MARK 11
LINK 1
REPL 7A
REPL 11
JUMP HOST

MARK 13
LINK 3
REPL 9A

REPL 13
;JUMP HOST

MARK HOST
TJMP NERV
COPY #NERV T;FILTER
HOST M
MARK NERV
HOST T
TEST T = X
DIVI #NERV T M
575/129/192 and a modified version with slight tweaks runs 2631/67/192

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply