Advent of Code 2020
cd ./cmd/<dayxx>
go build
./day01 -part a -file puzzleInput.txt
./day01 -part b -file puzzleInput.txt
./day02 -part a -file puzzleInput.txt
./day02 -part b -file puzzleInput.txt
./day03 -part a -file puzzleInput.txt [-debug] [-slopex X] [-slopey Y]
./day03 -part b -file puzzleInput.txt [-debug]
This code is nasty. Hardcoded array of structs, long winded validations. Needs to be reworked!
./day04 -part a -file puzzleInput.txt [-debug]
./day04 -part b -file puzzleInput.txt [-debug]
./day05 -part a -file puzzleInput.txt [-debug]
./day05 -part b -file puzzleInput.txt [-debug]
./day06 -part a -file puzzleInput.txt [-debug]
./day06 -part b -file puzzleInput.txt [-debug]
./day07 -part a -file puzzleInput.txt [-debug]
./day07 -part b -file puzzleInput.txt [-debug]
./day08 -part a -file puzzleInput.txt [-debug]
./day08 -part b -file puzzleInput.txt [-debug]
./day09 -part a -pre 5 -file testInput.txt [-debug]
./day09 -part a -pre 25 -file puzzleInput.txt [-debug]
./day09 -part b -pre 5 -file testInput.txt [-debug]
./day09 -part b -pre 25 -file puzzleInput.txt [-debug]
./day10 -part a -file puzzleInput.txt [-debug]
./day10 -part b -file puzzleInput.txt [-debug]
Unneccessarily verbose and plenty of duplicated code between part a and b that could be simplified. At least it works!
./day11 -part a -file puzzleInput.txt [-debug]
./day11 -part b -file puzzleInput.txt [-debug]
Took ages to get my head around the rotations in part b!
./day12 -part a -file puzzleInput.txt [-debug]
./day12 -part b -file puzzleInput.txt [-debug]
That took ages to make part b work quickly enough. Got there in the end. Note that part b has my puzzle input hard coded into main(). Change it here for your own puzzle input if you need
./day13 -part a -file puzzleInput.txt [-debug]
./day13 -part b
That was horrible. Got all twisted up with building lists in the wrong way. Ended up with a nasty hardcoded array of strings in the middle of a function as I was fed up with it!
./day14 -part a -file puzzleInput.txt [-debug]
./day14 -part b -file puzzleInput.txt [-debug]
Surprised that part a was efficient enough that part b was just "add the input and run it"!
./day15 -part a [-debug]
./day15 -part b [-debug]
Part b doesn't work. It does print out enough to be able to work out the answer by hand (yes, really), but needs to be finished to complete automatically. For now, I have my star so I don't care
./day16 -part a -file puzzleInput.txt [-debug]
./day16 -part b -file puzzleInput.txt [-debug]
./day17 -part a -file puzzleInput.txt [-debug]
./day17 -part b -file puzzleInput.txt [-debug]
- Day 18a
- [Day 18b]
./day18 -part a -file puzzleInput.txt [-debug]
I haven't solved Day 18 part b with code yet; I'll need to come back and do this properly. I realised that it was trivial to solve using vi search and replace then using bc so that's what I did:
$ vi puzzleInput.txt
:%s;^;(;g
:%s;$;);g
:%s;*;)*(;g
:wq
bc -l puzzleInput.txt > output2.txt
quit
paste -sd+ output2.txt | bc
./day19 -part a -file puzzleInput.txt [-debug]
Feels like I've gone wrong with the way I've approached Day 20 part a. It gives the correct answer but I'm matching double the number of sides that I should be doing
./day20 -part a -file puzzleInput.txt [-debug]
Very wordy code but it works quickly so it'll do
./day21 -part a -file puzzleInput.txt [-debug]
./day21 -part b -file puzzleInput.txt [-debug]
./day22 -part a -file puzzleInput.txt [-debug]
First time using container/ring. Got it working but had to rework the ring for part b. Went from looping through the ring looking for the destination, to using a map of rings as an index so I could jump around the ring easily
./day23 -part a [-debug]
./day23 -part b [-debug]
Getting a good coordinate system is a huge help here. I've used Axial Coordinates as described here https://www.redblobgames.com/grids/hexagons/
./day24 -part a -file puzzleInput.txt [-debug]
./day24 -part b -file puzzleInput.txt [-debug]
./day25 [-debug]