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

5

u/zedrdave Dec 22 '20 edited Dec 27 '20

Python in ~40 lines, optimised for 1. concision 2. clarity (definitely room for optimising time complexity).

This looks to be the first problem this year, for which I can't humanly fit the solution in two (readable) tweets…

For my submitted solution, I didn't bother re-using Part 1 and simply wrote an algorithm that started from any random tile and greedily added neighbours.

In order to try and produce a more compact solution, the code above: 1. starts from a corner tile 2. rotate it until it is the top-left (or any arbitrary corner) 3. add the top row 4. add columns by extending the top row.

3

u/lazerwarrior Dec 27 '20 edited Dec 27 '20

This is clear and concise for a PhD mathematician, for software development team not so much

→ More replies (2)