Paul's puzzle 57 solution - 37 parts


#1

Here’s my solution (it’s the one from the book):

And here’s the link:

http://www.lodev.org/jstumble/?board=0e0reellleerxx1eelxxrerllrlelgaegaeraralelrrlererleel

Description: To understand this one, remember the binary value of each number:

1 = 10
2 = 01
3 = 11

So the way this solution works is by testing each of the 3 ramps on top and then flipping the corresponding gear bits for it’s binary value.

It checks each ramp bit with a 4 ball cycle. The first ball tests the ‘3’ ramp bit. If it’s right, it flips the 1’s place of register A. The second ball tests the ‘2’ ramp bit. If it’s right, it flips the 2’s place of register A. The third ball tests the ‘3’ ramp bit again. This time, if it’s right, it flips the 2’s place of register A. The fourth ball tests the ‘1’ ramp bit. If it’s right, it flips the 1’s place of register A.

The gear bits are set up as latches so they can never be flipped back to 0.


#2

Interesting! My solution uses the same general principle as yours, but mine is messier in various ways—but mine also terminates (other than by running out of balls), which I had assumed was a desired behavior.

So in case this is of interest, here’s mine (38 parts):

https://www.lodev.org/jstumble/?board=1l11lellleerxx1eelxxlerilleelareeraglaeelragrererirer_16_16

A couple of things I don’t like about my version:

  • I’m assuming only one of the ramps at the top is set, so I don’t test all ramps in all cases. (Arguably this is an optimization, but it feels inelegant to me.)

  • Like yours, my solution uses a four-cycle, but unlike you, I didn’t figure out how to make two of the iterations go through ramp 3. That was what I wanted to do, but I was so hung up on testing the ramps in 1, 2, 3 order that I didn’t think of doing the first test of 3 on the first iteration. I like the way yours handles that.

  • I’m using red balls in a kind of haphazard way; I like that your solution doesn’t use them at all. I’m using them primarily as a way to get around my abovementioned 4-cycle problem.

  • Although mine does terminate—I think it never needs more than four blue balls and three red balls—it doesn’t do so in a very elegant way; when the 3 ramp is flipped, my version runs a couple of extra balls through at the end that don’t seem like they should be needed.

  • I dislike the lack of symmetry in my placement of gear bits. Mine might work just as well if I improved the gear bits’ placement, but I haven’t tried that.


#3

Aha! Here’s a variation on your solution that does terminate, in no more than eight balls. It’s the same as yours, but adds a few interceptors in key places.

https://www.lodev.org/jstumble/?board=0e0reellleeixx1eelxxrerllrlelgaegaeraraleliriererleel_16_16