Skip to content

Penguin Coding 7: Walk to the Corner Mystery Cache

Hidden : 6/27/2024
Difficulty:
3.5 out of 5
Terrain:
1.5 out of 5

Size: Size:   micro (micro)

Join now to view geocache location details. It's free!

Watch

How Geocaching Works

Please note Use of geocaching.com services is subject to the terms and conditions in our disclaimer.

Geocache Description:


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's son Pippin was a curious sort, and he secretly admired his dad and his curious way of looking at the world (and other problems in general), though he would never admit it out loud. He was a visual penguin, and had yet to (externally) show interest in his father's love of computers and programming. But he enjoyed posing problems to himself and see if he could solve them. Every day on his walk to school, he would enter a section that was an array of tiles, each with a numerical value on it. His goal was to walk from one corner to the opposing corner, adding up the values along the way, and trying to minimize the total value. At first he would just look at the two options and take the smaller of the two, but he had a feeling this wasn't the best algorithm. For instance, if he wanted to go from the NW corner to the SE corner, if he only considered a step to the south or a step to the east, he might encounter the "local minimum" but not the global minimum. Sure enough, he looked farther afield one time and found a longer path (by step count) with a lower value. "Oh boy!" he thought, "how big is this problem?"

Eventually Pippin broke down and talked to his dad. "Wow, you've stumbled upon a very well known but fun problem!" His dad beamed with excitement at his son's numerical interests. "You'll find that ..." Three words into the lecture Pippin began to regret his oversharing as his father droned on about some Dutch penguin he had once met, something about dikes or something. Eventually his dad finished his speech, so Pippin returned to listening. "Let's go to your grid and see if we can solve it!" he said, and they walked towards Pippin's school.

5715377076
4461000741
4825840396
8978604127
1379351546
6732089846
3211998137
6222120479
8176649996
2979902113

"See here" he lectured, as his son resisted rolling his eyes, "starting in the north-west, if you use the brute-force method, you would certainly choose to start south, since 4 is smaller than 7. "And you certainly wouldn't attempt to backtrack like I did there!" "Wow", Pippin had to admit eventually, "a score of 50 is pretty impressive. I don't think I ever got under 60." Reluctantly he added "Can you show me how you found that path?" Pablo put his arms around his son, sensing a rare teaching moment. Later, after things were explained, Pablo walked his son to an even bigger field. "Wow!!" Pippin exclaimed. "That's right" Pablo grinned, "let's see if you can solve this one. The best I've ever gotten is 487, and I'm pretty sure it can't be beat." "But ... these are not all numbers" said a confused Pippin. And after Pablo explained hexadecimal to Pippin, he was off to the races.


OK, here is the puzzle: given the following array of hexidecimal values (where A=10, B=11, ... F=15), what is the path from the NW corner to the SE corner that has the lowest sum value?

48DDFFAFAF7CEFCBCDACFDE887C77DE402EB9E75
E4EEEF9DC59EEA7E34EAFDE7554E4F44FC4C454E
21FEEFDFDE67FEACE9A86FA932FDDFDFEEFEFF9B
0DC204EDEDBA9DCB7EC8EDE121EAD9ECFFFBEEFD
48417A55E9A99EAD775ACCF25DFFA9ACDEDDFA9B
BFC2BCF56DFFAF7B7D7FEFE0E8FEDECAFFEECDAC
EFFFDF53AEDA9D59E79BBAB434EDFABEAFEFBEDA
DDEFEC46CBBDEE9EFC9AEEDEAFDEDEEDCEFEDFFF
6CDAEB2E6FF9FC99CBBFFFCEA4EDDEACBDFFEEFF
5EDCFC04AEAFEDEF9EEEEBECEFDDDECDABFDEEFE
CBF5DEEBFCDDCAEBCBCBBFDFC5244FFEFCFDEEFF
5FEEECF4FDCC9C87C9EADFFBADDF4EDFDDFFDEFD
7CFD4449BDADEBFC5EA85BBDFDDF9FFFECFEFEFE
7F9E4FFFFFE8EE79766EF9FDDE994FEEF9FFFEDE
F8BE4DFFFFFEEFFFB89BDECCDCEBE415F9EEECDB
6EF49DDFEFDFEDDFEEDDAEDDEBCDEE94FEEDEDFD
5ADEFFEED9FFFDEEEFD7AEADCAB9DDB455DCFDBE
6AE4FFFDDEFDED7AAB6769FD8BEDEDFB8320D9AC
5DD72C2F79ACCEE96D58FABAED5BDFFCB964E9FF
AE7FDE0AB5956CA89FAD68EDEA8AACDEDA71BDBC
AD47B64DDFDE796F9BBF6D9EAF9CE8EDD425CCE9
DFEDB4FFF9CCF75EFE5FF77EC79EFA98D5CFCD9D
F57699FFF9BE88B65777EEECADFD89BCE204EBAC
D875C4E442053484F52677F6EEBEBEDEEEFE33FF
A66DBACDDB9CD99BD9544E755FAD88ADFFDFA3EB
9F3FC6567BFD8B59ABEB5F5B8CFCFEEEDFCDA720
AB7ACCBCABA5C6A7A7CE5F5041E7975FCFECAE43
951B95E98CDE655E899A3E0CB544859BEFDF8D81
FAC9CECAD9A5BCD8ABCA5429EDC926AFEF9D9B93
CEABE5AD9EAD9E9B5BFEDEFFFEFE0BEF32343E28
F97DC9D7885DC5E997F9DDFDDDFF457E5FDEAEC5
AB6CFEB5BDCF55CCB9FCEDDCCB8D68C52CD6C8C6
DEBD9AEE9CFFECAABABA1302453554750FEEFEEE
49502EEC6956FF7AEACE3EBEDBDD2FEFFFEFEFAF
1FCAE243FBA5869BDF9C2C9FB9CF4DDCFFFFFFCE
5FDCDFA6303E223030223FDBF994FFEFFEFE0538
999DBB9EECD8B788FCDB9DD9CBFDEEFEF44F2959
2FBE7AACBA0BDFD565E755CBFEF29DEC057EDF73
1E6F8ED924EE1917FBA59E6CFAB04E4529AB9F21


You can validate your puzzle solution with certitude.


Congratulations to KendraH for the First to Find, and to pfalstad for the First to Solve!



Post-24h help update: Dijkstra's Algorithm (Pablo's reference to the "Dutch Penguin", perhaps?) is a famously simple and elegant way to solve this and other shortest-path challenges. It is used for things like best-route searches for route planning, and puzzles like this one. In its basic form, for this problem, pseudocode for it looks roughly like this:

push_heap([startx,starty,0,[]])
while(heap)
  [x,y,value,path] = get_lowest_value_heap_entry
  skip if already_visited[x,y]
  skip if illegal_x_y(x,y) # if going off the edge
  already_visited[x,y] = true
  value += grid[x,y]
  path.append([x,y])
  if(x==finalx and y==finaly)
    print "completed journey with value " + value + " and path " + path
    exit
  push_heap([x+1,y,value,path])
  push_heap([x-1,y,value,path])
  push_heap([x,y+1,value,path])
  push_heap([x,y-1,value,path])

This starts the "heap" (a random "pile of work" to churn through) with the NW corner and a total sum value of zero, and a null path. It then keeps adding all four possible directions from each location (x,y), adding in their numerical value, until eventually it reaches the final destination corner. The first key is popping the member of the heap with the lowest value of any heap member, thereby ensuring you're trying the most efficient step. The second key is keeping track of where you've visited, and skipping it if you've already been there. There is no reason to re-visit (x,y) if you've already visited it with a lower cost path on the heap! This guarantees at worst you visit each of the x*y locations at most once.

Additional Hints (Decrypt)

[hide] jnyx gb gur pbeare, svaq snxr ebpx

Decryption Key

A|B|C|D|E|F|G|H|I|J|K|L|M
-------------------------
N|O|P|Q|R|S|T|U|V|W|X|Y|Z

(letter above equals below, and vice versa)