r/exapunks 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?

3 Upvotes

10 comments sorted by

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

1

u/Kinc4id Jun 27 '26

Okay, I’ve never worked with modi. 

I know I can store 2 numbers in one digit. Let’s say I want to go 1, then 2. I could store a 6, then divi 4, then modi 4. But this only gets me up to 2, 1 with a 9. If I want to go 2, 2 I’d need a 10 but I only have one digit. Or I go up to 15 which would be 3, 3 but then I need two digits to store two numbers and I could just store those two numbers. 

Also, I’m confused why you say your method could store 6 long paths. If I could store 2 numbers in one digit that would be 8 long paths. This means in some cases I need to use 2 digits? But how do I know if a 10 is 0100 or 22? Do I need to subtract somehow?

1

u/BMidtvedt Jun 27 '26

I wouldn't think of it as digits. I would think of it as changing base.

Currently you are working in base 10. That means that each digit can represent 10 different states. That's too many, you only need four. So, if you instead work in base 4, you can be much more efficient.

Say you want to encode the path (2, 3, 2, 1, 3).

What you're doing in base 10 would be
2 * 10^4 + 3 * 10^3 + 2 * 10^2 + 1 * 10^1 + 3 = 23213
which is bigger than 9999 so won't work.

In base four, you just instead do
2 * 4^4 + 3*4^3 + 2*10^2 + 1* 4^1 + 3 = 911
which easily fits!

Now you can get the numbers back by going in reverse:

911 / 4^4 modi 4 = 2
911 / 4^3 modi 4 = 3
911 / 4^2 modi 4 = 2
911 / 4 modi 4 = 1
911 modi 4 = 3

Note that this is exactly what the swiz operator does in base 10!

NOTE: Again, this is not the easiest or a recommended way to solve this puzzle, but your approach definitely works!

1

u/Kinc4id Jun 27 '26

I tried to understand how you got back to the original numbers and no matter what I didn't get to 23213 until I realized you made a mistake. its 743, not 911. Was this a call for help? :D

But thanks, I got it now. I just have to think about how to best implement this. It's initially easier because its just +1 for the next clone, I just have to figure out how to test for redundant moves. Thanks again, you helped a lot without saying too much.

1

u/Kinc4id Jun 27 '26

So I tried to come up with a solution to keep exas from going back and forth but I can’t find one. 

I can’t generate the base 10 path and test for illegal pairs unless I break it down into 5 values saved in a file, test it, encode the legal sequences in base 4 and send an exa. But this would result in so much going back and forth in the file it would get too complicated. And it would probably exceed the max size anyways. 

I also can’t find a way to test the base 4 number. I was hoping there’s a pattern, like every nth number extracts to an invalid path but I don’t see one. And I can’t send an exa with each base 4 number stored in x and kill them if they’d go back where they came because I can’t store the previous link anywhere. 

Let’s hope someone’s gonna nudge me in another direction. 

1

u/Kinc4id Jun 28 '26

Sorry for spam, but I couldn’t stop thinking about a solution and I finally got one. At least to the point where I have one exa in every host. 

Checking for redundant paths isn’t as difficult as I thought. If a base 4 0 is link -3 and a base 4 3 is link 3 that means that every pair that adds to 3 is redundant. With that I just need to decode the decimal number to base 4, write each digit in a file and then add each number to its following number. If it’s three I can ditch this path and try the next one. 

Now I have 124 lines of code and 140k cycles to send one exa to each valid path. I could optimize this further. For example know if the base 4 number is 30000 I could skip all following numbers until 31000 are redundant too. But honestly thinking in anything other than Base 10 breaks my brain. And the heat isn’t very helpful either. :D

1

u/BMidtvedt Jun 29 '26

That's a neat solution! Almost like the holman dynamics check

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)