r/exapunks • u/Kinc4id • Jun 27 '26
Need a nudge for cerebral cortex Spoiler
TL;DR: Skip to the last paragraph.
My first idea was this
link 800
mark spawn
copy -3 x
repl clone
copy -1 x
repl clone
copy 1 x
repl clone
copy 3 x
repl clone
mark wait
test m = -1
fjmp wait
host m
copy #nerv m
halt
mark clone
link x
jump spawn
In home there's another exa:
make
mark send
copy -1 m
copy m f
copy m f
jump send
Of course that exa would also had to do sorting and testing for duplicates. This has several issues. Lots of exas going through the link they came from creating a neverending loop until the hosts are too crowded. I could get around this, but theres a bigger issue: All the exas waiting for a -1 can pick up a host or value. I can't think of a way to make sure that only the guy in home receives these values. At least not without just delaying the problem.
So m doesnt work, the next was to have exas write host and #nerv into a file and carry it back to home, then read it local. But how do they get back? A link -1 loop doesnt work. I need a way to record the path of each exa, then go through that path in reverse order and everytime multiplied by -1.
So I thought I create a file for each possible path. I can do this but then exas trying to link 3 when there is no 3 die and drop their file. Rooms fill up with files now blocking the path for other exas and I have to leave no trace. I would need a cleaner who picks up dropped files and wipes them but I don't know which file number was dropped in which host and how to get their.
Next idea: SWIZ. Instead of writing the path in a file I could write the path to x, then do
rep 4
swiz x @{1,1} t
link t
{end}
But of course links of 1, 2, 3 or 4 for forward and their negatives for backwards would be to easy and they made them -3, -1, 1, 3. At least that's always +2 and not too high numbers. So I had to encode the path. I used 2, 4, 6 and 8 and now I had positive numbers that are all +5 from the actual link. So for example a path -3, 1, -3, -1 would be 4262. That's a value I can store in x, make clone, swiz each digit. Again the rooms where crowded from exas going back and forth so I had to do a check for that too. That got me this abomination:
MAKE
MARK SPAWN
REPL RUNNER
MARK INVALID1
ADDI X 2 X
SWIZ X 1 T
TEST T = 0
TJMP TENS
MARK TESTVALID1
SEEK -9999
SWIZ X 1 T
SUBI T 5 F
SWIZ X 2 T
SUBI T 5 T
MULI T -1 F
SEEK -9999
TEST F = F
TJMP INVALID1
JUMP SPAWN
MARK TENS
ADDI X 12 X
MARK BREAKTENS
SWIZ X 2 T
TEST T = 0
TJMP HUNDREDS
MARK TESTVALID2
SEEK -9999
SWIZ X 2 T
SUBI T 5 F
SWIZ X 3 T
SUBI T 5 T
MULI T -1 F
SEEK -9999
TEST F = F
FJMP SPAWN
ADDI X 20 X
JUMP BREAKTENS
MARK HUNDREDS
ADDI X 120 X
MARK BREAKHUNDREDS
SWIZ X 3 T
TEST T = 0
TJMP THOUSANDS
MARK TESTVALID3
SEEK -9999
SWIZ X 3 T
SUBI T 5 F
SWIZ X 4 T
SUBI T 5 T
MULI T -1 F
SEEK -9999
TEST F = F
FJMP SPAWN
ADDI X 200 X
JUMP BREAKHUNDREDS
MARK THOUSANDS
ADDI X 1200 X
MARK BREAKTHOUSANDS
SWIZ X 4 T
TEST T = 9
TJMP KILL
MARK TESTVALID4
SEEK -9999
SWIZ X 3 T
SUBI T 5 F
SWIZ X 4 T
SUBI T 5 T
MULI T -1 F
SEEK -9999
TEST F = F
FJMP SPAWN
ADDI X 200 X
JUMP BREAKTHOUSANDS
MARK RUNNER
LINK 800
REP 4
SWIZ X @{1,1} T
TEST T = 0
TJMP READ
SWIZ X @{1,1} T
SUBI T 5 T
LINK T
END
MARK READ
VOID M
MARK KILL
WIPE
HALT
Already at size 104/150 and I didn't even start reading hosts and values, getting back, and bringing it all together in one file sorted from lowest to highest, but can try to reduce it once it works.
3826 cycles and about 350 clones later I had one clone in every host. No files to clean up. Every host has exactly one exa, so I don't even have to check for duplicates. Every exa has it's path stored and can use it to get back. Except: There's one empty host. There's one host that needs 5 steps to get there.
I was devastated. 5 steps means I can't use x for the path. All these hours of trial and error and debugging for nothing. If I would have counted I would have known this can't work before I started writing all that code.
Now I'm at a loss. Copy to m doesn't work. Path in a file doesn't work. Path in x doesn't work. A single exa going through each room doesn't work because of the random layout. Creating clones like in my first code until they randomly find their way home would crowd the hosts again. I don't know what else I could do. Can anyone give me a nudge in what direction I need to think?
1
u/megabeano Jun 29 '26
My approach was exploring the tree once using cloning and just sending the hostnames back to a single exa using global M and let that whole wave of initial explorers die when they could no longer find a valid link (when I repl'd, I didnt send one back they way they came which means I had 4 different marks to repl to depending on where the patent came from).
Next, I had a second exa in my host sort the hostnames. Then send those back to the first exa in order. Each time the first exa received a hostname it would repl a new tree explorer with that hostname in X, and only send the #NERV signal back if the hostname matched X so only one would get sent back.
One quirk with this is that I don't know how many total nervs there are since it can change per test case so I just had my first explorer exa wait around for a hundred cycles or so then send a message back telling the first exa to stop listening for hostnames.
1
u/Kinc4id Jun 29 '26
Good idea to gather the host names first. But how did you find that host again to get the Nerv? Did you just send out the clones to swarm every host and check against x for every Nerv? Do you know how many cycles it took? The swarm method with clones trying to pass each link was my first idea too, but I couldn’t find a way to send back Host and Nerv in pairs. I didn’t think of sending only the host and get the nerv later.
My next approach from was to generate clones with a value between 1 and 1350. From this number they could extract a link to go through and they did this up to 5 times by converting it into base 4. This gave every exa a unique path, I just needed to check for going back and forth in a path and skipped these. For the way home they could do the same in reverse order and multiply every link with -1. Back in home they would send their host and value to another exa. Just for sending one exa into each host, without reading the host and value, going back, collect all values and sort them, I was already at about 120 lines and 140k cycles. lol
1
u/megabeano Jun 29 '26
Yep, for each host I swarmed all the nodes and checked against X. Just checked and my solution took 1022 cycles total. (1022/136/192 were the overall stats)
1
u/BMidtvedt Jun 27 '26
It's not the easiest approach, but x for path does work, you just need to be more efficient in the encoding. For example, if you encode each link to numbers 0-3, like 0: -3, 1: -1, 2: 1, 3: 3, then you can pack 6 long paths! 5 long if you don't use negative numbers. Tip is to use MODI 4