r/adventofcode • • Dec 22 '16

SOLUTION MEGATHREAD --- 2016 Day 22 Solutions ---

--- Day 22: Grid Computing ---

Post your solution as a comment or, for longer solutions, consider linking to your repo (e.g. GitHub/gists/Pastebin/blag/whatever).

Note: The Solution Megathreads are for solutions only. If you have questions, please post your own thread and make sure to flair it with "Help".


SILVER AND GOLD IS MANDATORY [?]

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

edit: Leaderboard capped, thread unlocked!

4 Upvotes

82 comments sorted by

View all comments

Show parent comment

8

u/pedrosorio Dec 22 '16 edited Dec 22 '16

Yeah, pretty disappointing for an advent of "code" problem. I solved it this way as well - print the grid and then solve by hand (after a long time trying to solve the "general problem" and coming back to the statement and the example to look for clues).

I don't think this can even be solved by code as the A* makes strong assumptions about how there is an "open node" that needs to be moved around the grid which is just wrong in the general case. The example in part 2 gives a huge hint that the problem we're solving is much simpler, but that feels unsatisfying (I guess I have a bias against solving problems with strong hints to a simpler solution versus problems that are hinted to be simple but actually aren't)

6

u/topaz2078 (AoC creator) Dec 22 '16

A major part of software engineering is interpreting requirements and realizing that some problems don't need any code at all. AoC isn't 100% about writing code; it's about learning about the entire code process.

6

u/pedrosorio Dec 22 '16

Agreed on software engineering. I was expressing my personal opinion about what I find fun and interesting. AoC is not designed to optimize how much fun I have and I understand that, I think its goal is great and I'm having fun on most days, so thanks for that.

For today's problem my reaction may be colored by the fact that I took way too long to figure out the correct approach. In retrospect, it was obvious from an early stage that the general problem was not solvable for a 30x30 grid and I am frustrated I didn't try to look for alternatives sooner.

0

u/[deleted] Dec 22 '16

[deleted] — view deleted comment

6

u/topaz2078 (AoC creator) Dec 22 '16

This is definitely the case. In fact, I usually half-joke that if your boss comes to you and asks you to - just this one time, he swears - handle a bunch of rows in a spreadsheet, how many rows should there be before you automate it? 100? 50? 3?

I argue the answer is "always automate it, because it's never just this once" - except in AoC, when it is :D

0

u/[deleted] Dec 22 '16

[deleted] — view deleted comment

4

u/topaz2078 (AoC creator) Dec 22 '16

Hey, could you whip up a quick script that says whether a program halts? KTHXBYE~

1

u/AndrewGreenh Dec 22 '16

Yea, no :D We all reused some solutions from 2015 :P

1

u/drysle Dec 22 '16

Well, my code made those assumptions because I had looked at the input file to make sure those assumptions were correct before I even started the manual solving.

But it wouldn't be too hard to adapt the search to multiple empty nodes. And moving around any node except the ones close to the goal data is clearly not making progress, so the search time shouldn't explode too badly.

Adapting to non-empty nodes that still have enough space for the goal data would be slightly more tricky.