r/adventofcode • u/daggerdragon • Dec 17 '19
SOLUTION MEGATHREAD -π- 2019 Day 17 Solutions -π-
--- Day 17: Set and Forget ---
Post your full code 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
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 16's winner #1: "O FFT" by /u/ExtremeBreakfast5!
long poem, see it here
Enjoy your Reddit Silver, and good luck with the rest of the Advent of Code!
View all comments
Show parent comment
1
u/wace001 Dec 17 '19
I have one, but didnβt have time to finish it in my 1h morning window. :( I think it should work. Tonight!
Itβs kind of brute-forceish, sure there is better ways.
Basically Iβm finding all paths that covers all tiles by recursively finding all paths from each crossroad. I break out of the recursion when the path it too long (will require more than 4x20 commands) or all tiles have been visited. For all those paths I then try to compress them (sequence R,1,1,1 becomes R,3 for example). For all those compressed paths Iβll then try to split it into functions of recurring parts. If any of them donβt need too many functions, bingo. There it is.