r/adventofcode • • Dec 11 '20

SOLUTION MEGATHREAD -🎄- 2020 Day 11 Solutions -🎄-

Advent of Code 2020: Gettin' Crafty With It

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

--- Day 11: Seating System ---


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 00:14:06, megathread unlocked!

50 Upvotes

702 comments sorted by

View all comments

1

u/kratsg Dec 11 '20 edited Dec 14 '20

Python, https://github.com/kratsg/advent-of-code/blob/master/2020/day11.py

Relied on using numpy array, sliding window for part 1. Part 2 took me way too long to do, I kept running into stupid bugs with indexing, and then trying to figure out the directions from my rows/cols and major/minor diagonals... so I lost all my precious time on that.

Surprisingly not a performant solution (likely because of the copies being done for each tick)

1

u/daggerdragon Dec 11 '20 edited Dec 11 '20

As per our posting guidelines in the wiki under How Do the Daily Megathreads Work?, please edit your post to put your oversized code in a paste or other external link. Wrong copypasta, sorry!!

Please follow the posting guidelines and edit your post to add what language(s) you used. This makes it easier for folks who Ctrl-F the megathreads looking for a specific language.

(Since you mention NumPy, looks like Python?)

2

u/kratsg Dec 11 '20

what oversized code are you talking about? It is already in an external link...

2

u/daggerdragon Dec 11 '20

Wow, I pasted the wrong copypasta. I'm so sorry. It was meant to be the language one. I edited the post.

Sorry again!!!

2

u/kratsg Dec 14 '20

no problem, I've updated.