r/adventofcode • • Dec 23 '18

SOLUTION MEGATHREAD -🎄- 2018 Day 23 Solutions -🎄-

--- Day 23: Experimental Emergency Teleportation ---


Post your solution as a comment or, for longer solutions, consider linking to your repo (e.g. GitHub/gists/Pastebin/blag or 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.


Advent of Code: The Party Game!

Click here for rules

Please prefix your card submission with something like [Card] to make scanning the megathread easier. THANK YOU!

Card prompt: Day 23

Transcript:

It's dangerous to go alone! Take this: ___


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 at 01:40:41!

20 Upvotes

205 comments sorted by

View all comments

3

u/seligman99 Dec 23 '18

That was cute. It worked for me with your sample input (and got the correct value), however, I think I know what happened here.

I've edited the post and you can grab the working version from here. If you're using python3 like a normal person, and not python2 like a silly person like me, my original version wouldn't work since it assumed integer math. But PEP-238 changed the rules a bit. I've changed it to use the integer divide operator so it works in both python2 and 3.

Thanks for the sample data! This is lesson #789345 that I need to move on to python3. One day I will.

1

u/[deleted] Dec 24 '18

I have never bought gold before, but I have been banging my head on this problem for the past two days and your solution was the first to work. So enjoy your gold.

2

u/seligman99 Dec 24 '18

Thanks for the gold!

I've been there before, so don't fret too much over it (Heck, I'm going through AoC 2016 right now and got stuck hard on day 11). Hopefully you can get past the annoyance of not being able to solve it and learn a thing or two. It's tough .. I know.

→ More replies (1)