
Penguin Pablo has recently been really honing his programming skills, and is here pushing his new series, the Penguin Coding series. His puzzle inspiration is varied, but he was recently seen struggling through another polar-themed puzzle event, the yearly Advent of Code challenge, though studying those is not at all required.
Unlike the Penguencoding series, there is no D1, but the series should roughly start easier, and progressively get tougher, with some of the early ones as practice for future ones. But fear not! Pablo is a generous sort, and is very free with hints - or at least after the FTF!
No particular language is required! Only the answer is needed. Typically once you've completed the coding the coordinates should be obvious, but perhaps you'll have to do a little lateral thinking to see them.
Given the nature of coding puzzles - where true coders will consider a puzzle "too easy" that is opaque to non-coders - Pablo has decided to provide help in the form of algorithms, pseudocode, or code snippets, but only after 24 hours of release. That way the coders can have their try for FTS, and non-coders can get assistance to start. The updates will be given at the bottom of the text page sometime on or after the second day.
Pablo visited the south pole messaging system last week, and encountered a frustrated and sad Post Master Penguin General. He had had a conversation with a friend who had left him a secret message, and the means for cracking the code. But alas, his memory faded, and while he didn't forget the mechanism, he forgot where the message started. He was simply left with the seemingly random set of letters, shown below. He knew the mechanism: each letter was its own key on how to proceed reading the code. The message was a string of letters - no spaces - where the letter itself said where to find the next letter of the message in the array of characters. He remembered that the message started on one edge, moving inward at first, and that the next letter would be d (distance) characters away after possibly turning to the left or right. Each letter had a numerical code value (the usual one around these parts, A=1, B=2, etc to Z=26), and the distance to "walk" to the next letter was a function of its code value, d = ((code-1) % 9) + 1, so A walked 1 step, B walked 2, I walked 9, J walked 1, K walked 2, all the way to Z walking 8. If it "walked" across the edge then it wrapped around to the other side. But which way was the turn? A-I first turned to the left, then walked; J-R simply walked in the current direction; and S-Z turned right, then walked. This is represented in the table below.
| d | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
| L | A | B | C | D | E | F | G | H | I |
| N | J | K | L | M | N | O | P | Q | R |
| R | S | T | U | V | W | X | Y | Z | |
As an example to make sure the mechanism is understood, imagine that the message written was "MESSAGE", then the list of letters could be as below, with the obfuscating letters grayed out for visibility. You can see the progression of this more clearly in the image above. Here the first letter of the message, M, is on the west side, and the initial direction of the coding of the message string is inward, or east. M has no turn, and a distance of 4, so the next letter is placed 4 characters to the east. E is next, which first requires a left turn, then a walk north 5 spaces before writing S. S turns right (east), walks 1, writes S, turns right (south), walks 1, writes A, turns left, walks 1, writes G, turns left, walks 7 north (wrapping around the boundary and starting at the bottom) and writes E.
| USCQEIJYKE |
| UYGNSSBCQO |
| EHMPVAGRKP |
| SKXVKZSRFP |
| XEJXACXBJD |
| CIUDLTEUGN |
| MGMYEVOLAX |
| POOJPAJDZV |
| RWGVXULTQY |
| QNFPDTXIPF |
"Hmm, sorry I'm so forgetful, I really should have kept better notes as to where the message started, and now I can't read this message", lamented the Master. "I know it had the word congratulations somewhere in there, but I don't think that will be helpful."
"That's OK" asserted Pablo, "I'm confident we can figure this out, I just need to write a little program ... Yes, wait, no ... how about ... no, but ... yes! I've found it!"
OK, here is the puzzle: given the following array of characters, and knowing that the message starts on one of the edge characters heading inward, what message did the Post Master receive from his friend?
| PQUIKEDMBZVRKNEQMQFBGCXEQOINXBZYKRZSBVXRKYIKAJKPFZV |
| EBXFTELPRXHZDELOAFYOMNAKFSAZMUUXBEMYIRXWXHKQTTMMZYH |
| NASPFLVARCEAZAHUJOLGUUCEQYBKYMIPSGBGVAXSWLIGBLIYLSQ |
| WXTXULXFQPNWVFXWDSFPVDSEPKODBBHVCVSUMUFXCBENAJKQQLI |
| SXDGORARDLMEJUSNWIYTSGALQRAFAUAIIVBNCOUKNABXZSALVIU |
| NRKPDHQVTTOMLECHWVVYTWXKGQVFJXSUPNOAPLJNIRVJNVPOTTG |
| ZGAFPFCUYSRHHNMUTGUNDCMKIKUVXVQXHTBOZFAPDBFXNPLGAFO |
| GVGHFLYRQVKYSOPLABKVPAJKEJDVTMYSFSMOYJEVAITUFCLCBJI |
| DGWRMSYYUOJSLTLRRRGFVWZJTIAUZNGDERSHBTSHLOBNPNRIIKF |
| FCTDBESROGCFGNNTCWLFTESIEQLOERHPXBXEUCHEPXCBXHZJRUU |
| GQIFVWEL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LFRROOTOGOYFKPUWENFARHPHOHNBRXJBVXWLDFH |
| FCIVKGINMQFQPJOGKCZNRVQIDAFSDKSVWLNHBPYEUVXFLSOVLNJ |
You can validate your puzzle solution with
certitude.
Congratulations to First Finder yoyo ken and First Solver LydiaSimmons!
Post 24h hint update: there is no real trick to this one, you just need to start at each of the 200 or so outer edges and keep track of the letters that arrive. You can print out the message you see and look for "CONGRATULATIONS". The inner loop looks something like this:
| print chararray(x,y) |
| code = get_code(chararray(x,y)) |
| (nextx,nexty,nextdir) = get_next_xy(x,y,dir,code) |
| stop if visited(nextx,nexty) |
| visited(x,y) = true |
| (x,y,dir) = (nextx,nexty,nextdir) |
This stops when it gets a repeat character since that would be an incorrect message. get_next_xy takes current x,y and direction and uses the character code (A=1,B=2,...Z=26) to determine the change. Here is some Perl and then Python snippets to get the character codes.
| sub get_char_code { |
| my($chr) = @_; |
| return unpack('C',$chr) - unpack('C','A') + 1; |
| } |
| def get_char_code(chr): |
| return ord('C',chr) - ord('C','A') + 1 |