r/adventofcode • • Dec 03 '19

SOLUTION MEGATHREAD -🎄- 2019 Day 3 Solutions -🎄-

--- Day 3: Crossed Wires ---


Post your solution using /u/topaz2078's paste or other external repo.

  • Please do NOT post your full code (unless it is very short)
  • If you do, use old.reddit's four-spaces formatting, NOT new.reddit's triple backticks formatting.

(Full posting rules are HERE if you need a refresher).


Reminder: Top-level posts in 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's Poems for Programmers

Click here for full rules

Note: If you submit a poem, please add [POEM] somewhere nearby to make it easier for us moderators to ensure that we include your poem for voting consideration.

Day 2's winner #1: "Attempted to draw a house" by /u/Unihedron!

Note: the poem looks better in monospace.

​ ​ ​​ ​ ​ ​​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ Code
​ ​ ​ ​ ​ ​​ ​ ​ ​ ​ ​​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ Has bug in it
​ ​ ​ ​ ​ ​​ ​ ​ ​ ​ ​ ​ ​ ​ ​ Can't find the problem
​ ​ ​ ​​ ​ ​ ​ Debug with the given test cases
​​ ​ ​ ​​ ​ ​ ​ ​ ​ ​​ ​ ​ ​ Oh it's something dumb
​​ ​ ​ ​​ ​ ​ ​ ​ ​ ​​ ​ ​ ​ Fixed instantly though
​ ​ ​ ​​ ​ ​ ​ ​ ​ ​ ​​ ​ ​ ​ Fell out from top 100s
​ ​ ​ ​​ ​ ​ ​ ​ ​ ​ ​​ ​ ​ ​ Still gonna write poem

Enjoy your Reddit Silver, and good luck with the rest of the Advent of Code!


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 00:13:43!

53 Upvotes

507 comments sorted by

View all comments

1

u/kcarter80 Dec 03 '19

The test data does not include situations where the wires go "below" or to the "left" of the origin. This is a problem if your chosen data structure does not allow negative indexes.

My feeling is that the test data should include obvious edge cases. Including these edge cases in the test data doesn't make discovering the edge cases materially easier, and it makes debugging much, much easier.

Is the omission intentional or coincidental?

1

u/gerikson Dec 03 '19

The example data is a balance between explaining the problem, and not making stuff too easy. It's always a good idea to eyeball the real data to get a feel for what kind of values might appear.

In my case, I had plenty of D and L statements with 3-digit values, which let me to plan for negative numbers.

1

u/kcarter80 Dec 04 '19

Could you explain how having test data that covers edge cases makes finding the solution easier?

1

u/daggerdragon Dec 03 '19

Top-level posts in Solution Megathreads are for solutions only.

This is a top-level post, so please edit your post and share your code/repo/solution or, if you haven't finished the puzzle yet, you can always post your own thread and make sure to flair it with Help.

If you disagree with or are confused about the puzzle's wording, contents, or solving methods, you're more than welcome to post your own thread about it and move the discussion over there.

Either way, please create your own thread if you have feedback about the puzzles. This type of comment does not belong in the Solutions Megathread.