
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.
After all the recent hard work and a curious stretch of extremely harsh weather, Pablo realized that the clan needed a diversion. He hired an outfit that specialized in team building and fun, in this case Perry's Penguin Pipeline Playground Proprietors. They built the coolest and most elaborate set of slides Pablo had seen. The slide was a set of pipe segments, and jumping on the slide you could twist and turn for endless frosty fun. To visualize the system, certain characters are used to represent the corners and the straight parts. In the small example below, there is one long slide, circling around the array of characters. The - and | characters are the straight bits, and the corners are represented by L J 7 and F. This small example has 44 pipe segments, and twists and turns without ever losing the single loop.
| .....F--7... |
| F--7.|..|.F7 |
| |..L-J..|.|| |
| |.......L-J| |
| |.F--7.....| |
| |.|..L--7..| |
| L-J.....L--J |
One problem that Pablo figured out after Perry and his team left: they were so lazy that they left pieces of unused pipe all over the place!! They left before Pablo paid - Perry said he would bill Pablo by the length of the slide - but he couldn't tell how long the slide was, he couldn't just count the pieces. What a mess! He also wanted to get a sense of how big his cleanup cost was going to be to get all that extra pipe out of the way. He liked to maintain an orderly playground - "unlike some penguins" he muttered under his breath - and sent for a cleanup crew. The cleanup crew, led by his friend Puffen, said they would handle it, and would bill him too. But the pieces of pipe inside the loop cost more for difficulty of access! Here's an example with a few pieces of wasted pipe lying around.
| .|.F.F--7.L. |
| F--7||.L|.F7 |
| |7LL-J-.|-|| |
| ||.J..7.L-J| |
| |-F--7|J.-.| |
| |.|J.L--7.-| |
| L-J.-.|.L--J |
OK, here is the puzzle: given the following pipeline playground, what is Pablo's bill for the slide from Perry? And how about for the cleanup by Puffen?
- Perry charges 4175 krill flat fee, plus 7 krill per length of the slide (wasted pipeline pieces were not charged).
- Puffen charges 200 sardines up front, plus 3 sardines per pipeline piece outside the slide, but 8 for pieces inside (distinguished as red above in the example)!
To make it easier (for the fee calculations, and for the pipeline riders), a starting point sign for the loop was provided (on what would have otherwise been a vertical | piece of pipe). This is marked with the letter S on the left side of the pipeline below.
To use the example above, with 44 total pieces in the pipeline slide, 8 junk pieces outside the slide, and 12 junk pieces inside the slide:
- Perry would charge: k4175 + k7 x 44 = k4483
- Puffen would charge: s200 + s3 x 8 + s8 x 12 = s320
| --F---7.-..F--7|L.......F--------77......F--7.JJ.J........||..F-7..F------7.....|J7-..JFL........|.. |
| J.|J..|L.F.|.||.7F-7...|L---7.J..L77LF-7.|-FJ.L.F---7.......F.|.|.FL--7..FJ..F--7|....LF..L..F..L||. |
| .FJ.F-J....L7.L7||J|FF--7L..|F-7.||F.|.L-J.|....|.|FJ..F---77.|FJ..7.J|.FJJ.FJ..|..F--7L...J.F7..7.. |
| FJ..|.F-7...|.FJ.|FJ.L7.L-7.||.L7L|.FJ..F7L|..F-J..|J..|.|.L7.||-.7.F-J.|...|-.L|F.|..|.|..|FJL7-... |
| |J-FJ.|.L---J.|F-JL7..L-7.L-JL7JL-J.|J..|L-J.-|...7L---J|...L-JL----J.7.L---J..FJF-J7.|7-.LFJ.FJ...7 |
| |..|7FJ.FF7..-LJ-..L-7..|..F-7|JF---J..||.F---J....F7....F...-...L.L7........|FJFJJ..J|....|.FJ..... |
| L7.|.L7|-F---7FF.F-77L7.L7.|FJ|.L-77F..FJ.|.F.....FJL7|.L.F-----7........J..F.|.|.L..FJ...FJ.|.-L... |
| .|.L77|.FJ...|...|.||.||.L7||.|-..|-..||..|.F..-FL|.J|..F-J...7.|..F......F---J.|-.F-J7..FJJ.|..-|.L |
| .|-.|.L7|7..FJ..J|.L7.|.F.||L-J.-FJ.JF-JF-J|......|.LL--J.-..F.JL7|.JL.F--J..L.FJ|L|...|FJ..FJ..F... |
| .|..|..|||LFJ-..FJ.||.L7.J||F-77.|...|..|...F-7.|.L7.-|L7F-7.F-7JL77.F-J....F--J...L----J...|....... |
| FJ..|..LJ..|...FJ...|..L7.|LJLL--J...|.7|...|.L-7J-|.L.F-J.|.|.|..L--J.....FJ...L...JF-7L.L.L7.|.... |
| |..FJ.F---7L7..L77|.L7..L-JJF--------J.-L7|-|...|..L---J...|.|.|.J|....J|.7|L.......FJ-L--7.FL7F-7.. |
| |..|..L-7.||L7.-|....L7...7.L--------7...|..|...L-----7..L.L-J.L-----------J..J-|..FJ..-F.|...LJ.L7. |
| S..L-7.||.|..|..L---7.L--7.F--7...7.|L---J..|....-F7-.L7.......LFF--7...7..........|...7.LL-7.7.L.|F |
| |L...L7.|LL7.L-----7|F.F-J.|J.|--F---7.|.|.L|..-|FJ|...L-7...F.F-J.-L-7L|.......F--J.F--7...L-----JJ |
| L7....|JL-7L7.7F-7.LJ|.|.F-JF-J|.|||.L7-|F..L7.L.|-L7.-F.L-----J.J....|.F......FJJ7..L7.|....|..J|.. |
| .|.F-7|...|.|.L|.L-7...L-J..|.F-FJLF7.L7-...L|.-.|J.|..F......L-.F-7..L-7L...F-J......|.L-----7..L.. |
| .|.|.LJ...|.|.-L-7|||F--7L.7|..FJ7.||.JL--7..L-7||.JL----7...F---J.|....L----J......F-J.....J.L-7..L |
| |L7|....-FJ.L7.J7|.|-|..L7.|L--JF--JL-7...|..L-|7|FJ..J..|..FJ.J...L7.........JF----J.7.LF---7.JL--7 |
| ..|L7..|FJ7..L---J.||L7..L7..F-7|F--7.|...|..-.L-J-7J..F-J..|.J..-..|.-...F----J..F..-..L|..F|F....| |
| F.|JL---J..JF----7J|..|...|.J|.|||.FJ.|-F-JF----7......|L..F|JF-7|..L--7.7|..F-7.JL..F---JL..L-----J |
| ..L-7.L.J.F-JF-7.L-J..|...|.FJ.||L7|.J|.L--JF---J..F7J.L----J.|.|.--...|.||..|||..F--J.............. |
| .J.|L-7.L.L7.L7|....F-JLF-J.|..||.||..L-7...L-7...F--------7..|.L7..-F-J.7|..|F|..|....7..F-7F7.J..L |
| -7.|.7L--7F|F.|L----JL..|...|.FJ|.|L--7.L7J..L|F--JJF--7L..|.7|..L7|||.7-.|.L|.|..|.....F-J7L---7.7. |
| F--7J..-.|.|..|J.-..F---J-.||.|.L-J-..|..L--7.LJ.F--J.LL---J..|...|F.L----JJ.|.|L.L-7L..|..7.F..|... |
| ||.L-7.JF|.L7.L7J-F-J....L|.|JL-7.F...L-7.F.||F--J..F---7....FJ..-||..F......|.|-J..L---JL.F|F--J.7. |
| |...|L7.L|..|..|F.L----7.F--J.--L-7..-F.L-7.|.|..|LFJL..|..L.|....|...-.F..F-J|L-7.J.....F---J..J|JJ |
| L7.J.F|.FJ..||F|.F--7..L-J..L.....L---7...|.|.L7..FJ7..FJ7.-FJ....L7..F....|.L|-.L-------JL...F..... |
| 7L7...L-J.-FJ..L-J..L------7..F---7...|.7FJ.|L.|.-|.7LJ|.L..|..-|L.L-7....L|...F---7....F----7..L... |
| .JL--7.F|L.|7.F.J..7.......L--J...|.|.|..|.FJ.L|..|..|-|.F--J....7..|L-7...L---J...L----J....|.-...| |
| ..|L.||..L.L----7..F-----7..F...7.L7..|.7|.|F..|7.||..FJF|......F-7....L-7..L7...7J.....-....L-7F.7| |
| .F-7.L--7JF---7.|..|.-...L7.F---7..|F.|..|.L---J.FJ...|.F|....F-J.|.-...FJJ...7.L.J....F---7.L.|.... |
| .|.|.F..L-J.F-|.|..L--7...|.|..F|..|.FJ..L--7...FJ...||..L----J|.-|L..F-J...........7F-JJ..L-7.L7... |
| FJ.L---7..F---J7|L..L.|..FJ.L7..L7J|J|.F-...|.|.|.....|..7.......J|F..|...F..F-7...F-J.-7..7.|..|... |
| |..|.|JL--J....FJFF.F-J..|...|...L-J.L-7.|F-J7.FJ.|...L---7......FJJ..|.J..F-J7|.|.|.F-7..JF-J..|.7. |
| |F.F--7...F---7L----J....|..L|L7F---77.|.FJ....|.-.-...7.FJF-----J|..FJ...F|...|...L-JL|.J.||F--J... |
| |.||..L---J...L----7...F-J..-L--J.L.|..L-J....FJ.F---7.7.|J|...7J7..FJJ..F-J.F-J.J.L-..|...|.|.F--7. |
| L7.|F.F---7.F|.....L7|.|.F------7.J7|....J...7|7-|J..L-7.|JL--7.|7..|..-.|...|..-.F.F|FJ.-.|.|-|..L7 |
| 7L-J|FJ7..L----7.|..|L.L-J......L--7|...F--7J.|..|.F7..L-J.77.|.....|....|...L7......FJ.FLFJ.L7L7-.| |
| F--7L|F........L--7.L7......F----7.||.F-J.J|..|L.L-7...|L...F.L-7...|.J.FJ7...|..JF--J...F|...|.L-7| |
| |F-|F|....|F---7..|.-L7...F-J....|LLJ.|....|L.|.|J.L---7.......7|.-7|...|....JL7..|.LF-7F.L-7.L-7.|| |
| |..|||.F---J.L7|.FJ..FL---J.LF---J....L7.7.|..|.||..7F.|........|.FFJ.--|.L....|..|..|.L7...L7..|.|| |
| |FFJ.|FJ....F--J.|.F-----7.J.|......F.F|..L|..L7.F--7.FL-7FJ.7F-J..|....L7F.-..|.||..L7.L77..|..|||| |
| |7|.-||.|F--JJ..-L-J....-|...L-7...F---J..-L7..|.|J.L-7..|L..7|.FF-J.77..|..JJ.|..|...L7.L77F|..L-J| |
| |.|..LJL.|L|...F------7|.L-7..-L---J..F|.-..|FLL-J..-.|.7L----J|.|....L.LL7..F-JF.|....L7.L-7|.|LF7| |
| |LL-7-.F-J-..F-J.-..|.|F..-|F----7.F---7....L-7...L...|...F....J-|.7..F---J77|...7|..-..L7..||...F-J |
| |J..L--J...F-J.7F--7..L-7..||...LL-J...L7F----J......7L-7..F--7.|L7...|F|.JF.L7..7L7.-|L.L7.LJ.F-J.J |
| L-7.F......L----J..|....|J.LJ.F-----7.L.LJ...J--F.JLJ.L.L--J..|...L7-.L-7.....L7-.-|.F-7..L7...L--7. |
| ..L--7.F-----7.F-7.|....L-----JJ...-L-7.-J.|F---7JLF-----77...|....L7...|..J.7.|...L-J.L7..|..-.-FJL |
| J.F..L-J..|.|L-J.L-J|.F..JL...........L-----J...L--J|.|..L----J..|-.L---JJ..F.FL--------J..L-----J.7 |
You can validate your puzzle solution with
certitude.
Congratulations to KarenLona and gw0143 for First to Find and pfalstad for First to Solve!
Post 24h hint update: The first part of this problem shouldn't be *too* hard, just need to navigate the grid, turning or going straight based upon which character is encountered. For part two, since this is a D4.5 after all, I won't say too much except see if you can see a way to observe what is inside and what is outside the pipeline when you walk left to right one row at a time in the first (uncluttered) example. (The same thinking should work walking vertically as well.)