Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

GitHub go.mod Go version Go Report Card

advent2020

Advent of Code 2020

Instructions

Compiling the code

cd ./cmd/<dayxx>
go build

Days of Advent

Day 1 - Report Repair

./day01 -part a -file puzzleInput.txt
./day01 -part b -file puzzleInput.txt

Day 2 - Password Philosophy

./day02 -part a -file puzzleInput.txt
./day02 -part b -file puzzleInput.txt

Day 3 - Toboggan Trajectory

./day03 -part a -file puzzleInput.txt [-debug] [-slopex X] [-slopey Y]
./day03 -part b -file puzzleInput.txt [-debug]

Day 4 - Passport Processing

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]

Day 5 - Binary Boarding

./day05 -part a -file puzzleInput.txt [-debug]
./day05 -part b -file puzzleInput.txt [-debug]

Day 6 - Custom Customs

./day06 -part a -file puzzleInput.txt [-debug]
./day06 -part b -file puzzleInput.txt [-debug]

Day 7 - Handy Haversacks

./day07 -part a -file puzzleInput.txt [-debug]
./day07 -part b -file puzzleInput.txt [-debug]

Day 8 - Handheld Halting

./day08 -part a -file puzzleInput.txt [-debug]
./day08 -part b -file puzzleInput.txt [-debug]

Day 9 - Encoding Error

./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]

Day 10 - Adapter Array

./day10 -part a -file puzzleInput.txt [-debug]
./day10 -part b -file puzzleInput.txt [-debug]

Day 11 - Seating System

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]

Day 12 - Rain Risk

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]

Day 13 - Shuttle Search

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

Day 14 - Docking Data

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]

Day 15 - Rambunctious Recitation

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]

Day 16 - Ticket Translation

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]

Day 17 - Conway Cubes

./day17 -part a -file puzzleInput.txt [-debug]
./day17 -part b -file puzzleInput.txt [-debug]

Day 18 - Operation Order

./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

Day 19 - Monster Messages

./day19 -part a -file puzzleInput.txt [-debug]

Day 20 - Jurassic Jigsaw

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]

Day 21 - Allergen Assessment

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]

Day 22 - Crab Combat

./day22 -part a -file puzzleInput.txt [-debug]

Day 23 - Crab Cups

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]

Day 24 - Lobby Layout

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]

Day 25 - Combo Breaker

./day25 [-debug]