MC: Ping-Pong Cubes
|
05-26-2018, 05:01 PM
Post: #11
|
|||
|
|||
RE: MC: Ping-Pong Cubes
(05-25-2018 10:55 PM)ijabbott Wrote: I don't know if there is a clever trick to this problem (I can't think of one, but I'm not that clever!) or if it's just a brute force search. If the latter, it's not very interesting to me, Most challenges/contests posted here are crafted by people who have already found some amount of optimization to the problem at hand prior to initiating the challenge. Sometimes there's no known shortcuts, though, and the challenge is presented in the hopes that someone may discover a useful approach to a solution that hasn't yet been thought up. In this particular case, the similarities with some other challenges provide some clues as to some possible optimizations. In my case, I didn't use any of them and instead simply wanted to use a "generic" solution as a basis, then refining the process with increasingly specialized translations of the code. Some here have expressed interest in SysRPL, so I thought a RPL->SysRPL->Saturn progression might show some interesting performance differences. That said, I did try several methods before settling on the "brute force" test that my RPL/SysRPL code used, including Didier's ΔLIST/ΠLIST approach. I was actually surprised to find that even some optimized list processing approaches were slower than what I ended up using. I realized that ANDing the numbers with"111.." would result in "10101..." results for ping-pong numbers, which could then be divided by 11 for interesting intermediate results, etc. But all those transformations in RPL ended up being slower than simply testing for alternating parity of each digit. That's part of the fun of challenges like this -- you learn a lot through the experimentation. "The journey is the reward." |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 4 Guest(s)