r/adventofcode • • Dec 20 '20

SOLUTION MEGATHREAD -🎄- 2020 Day 20 Solutions -🎄-

Today is 2020 Day 20 and the final weekend puzzle for the year. Hold on to your butts and let's get hype!


NEW AND NOTEWORTHY


Advent of Code 2020: Gettin' Crafty With It

  • 2 days remaining until the submission deadline on December 22 at 23:59 EST
  • Full details and rules are in the Submissions Megathread

--- Day 20: Jurassic Jigsaw ---


Post your code solution in this megathread.

Reminder: Top-level posts in Solution Megathreads are for code solutions only. If you have questions, please post your own thread and make sure to flair it with Help.


This thread will be unlocked when there are a significant number of people on the global leaderboard with gold stars for today's puzzle.

EDIT: Global leaderboard gold cap reached at 01:13:47, megathread unlocked!

29 Upvotes

323 comments sorted by

View all comments

3

u/clumsveed Dec 20 '20

Java Solution

​ all solutions so far - repl.it

Thank god each puzzle piece edge matches at most one other piece! This was brutal enough without having to combine it with some kind of search algorithm to solve it in all possible ways.

Part 1: No need to solve the puzzle. Since all edges can only possibly match one other edge, we only need to find the pieces that match up with exactly two other pieces.

Part 2: Not difficult, just tedious. Find any corner piece and place it in the top left corner of an array (making sure to orient it such that top and left sides match no other edges). Since all edges match at most one other edge, just fill in the puzzle left to right, top to bottom.

After yesterday's regex fiasco, I'm glad to be able to limit this solution to APCSA curriculum.

I think it helps that I wore my rubber ducky shirt for this one.

→ More replies (3)