EXAPUNKS

EXAPUNKS

View Stats:
[Bonus campaign] Netronics Net40 Modem
Warning below will be spoilers for the solution.

I just wanted to celebrate the fact that after revisiting the puzzle, I've managed to break through the 20k cycles barrier.

Now, in the distant past, I had with steps of +- 10k, gotten this down from a high of 65k or so, to a very reasonable 24k. One frustration with this puzzle is that simply evaluating all scenarios on even a reasonably fast computer will take a long time. I think it's partly to me simply getting a more powerful computer, that it became palatable to experiment with the optimizations.

In this post, which will be quite spoilerific, I want to delve a bit into how I approach this puzzle.

At first sight, this puzzle is not that complicated. You have some X's in an 11-digit number that need to be filled in with numbers, each time you dial. Numbers that go up. Sounds like a job for 'swizzle'.

My setup takes two exa's: a dialer and a storage exa.

The dialer runs a number, checks whether it was succesful (thank goodness, there's a simple hardware register present for that).

If it is succesful, send the number to the storage exa, if not, skip it.

The termination condition is also quite straightforward. Since we know it's always 8 numbers, the storage exa just counts the numbers received, and after number 8, drops its file, moves in and kills the dialer, and wipes the dialing file.

But then comes the most tricky bit: updating the number to the next number to be dialed.

Now what makes this puzzle hard is that updating the phone number is not as straightforward as hoped. This is mostly due to the fact that we're dealing with anything varying from a single digit to three digits that need updating. Also, it's always the *last* of the digits that needs updating, and only sometimes the ones in front. You *cannot* run all the numbers in a different order, because the target condition is very specific about the order.

Now a solution could be to run the update of the number front to back, rather than back-to-front, and sort the numbers afterward... I haven't tried that, and it sounds like it could be complicated.

Instead I have worked with two main approaches:

The one that I can get to about 40k: I replace each X with a ten.

Whenever I need to update the number, I run *backwards* through the number, finding each number that's bigger than 10, and using the appropriate swizzle. Checking whether we just reached 0 (MODI X 10 T) helps make it more efficient, by only updating the digits that need to. (As opposed to always checkinge exactly 11 digits, because you don't know how many variable digits there are, and there's no TEST "BOF". Remember we have to run this backwards...).

The other approach, which I can get to 20k (and slightly below) requires more prep work, but is a lot faster for it:
Instead of overwriting the X's in the phone number with 10s, they just become 0's, but during this prep their relative position is stored as an offset after the phone number. In reverse order, so the 'least significant' digit is always immediately after the phone number, etc.

So, Instead of having to search the full phone number for the location of the varying digit(s), now the location can always be found by going to the 12th, 13th and/or 14th digit and then performing a SEEK F. This is to be followed by the appropriate swizzle, of course.

Both the dialloop of a phone number and the copyloop for a succesfull one are simply me repeating the copy-command 11 times. No need to be fancy there, it's hard to be more efficient.

End result:
Cycles: 19892
Size: 105
Activity: 3

Hope any of you found it interesting to read. Always curious to hear about your own approaches to this fiendishly computationally intensive bonus puzzle.