Files
aoc2021/README.md

68 lines
1.5 KiB
Markdown

# Advent of Code 2021
The 2021 iteration of Advent of Code. This year I am going to try and accomplish it all on my iPad using GitPod
## Adding a new day
When starting to solve for a new day run the following command in the root of the repo where `<day>` is the go lang compatible package name (i.e. `four` or `five`) and `<noun>` represents the item the day's problem revolves around (i.e. `radar` or `bingo`).
```sh
./setup.sh <day> <noun>
```
After generating a new package update [`main.go`](main.go) to include a `<day>` flag in the switch statement on line 28
```go
case "<day>":
day = <day>.Init("<day>/input.txt")
```
## My Solutions
### Day 1
```sh
$ ./aoc2021 --one
The solution for "one" is:
There were 1715 increases in depth
There were 1739 increases in depth when sampling a window
```
### Day 2
```sh
$ ./aoc2021 --two
The solution for "two" is:
Horizontal is 1832, depth is 1172, answer is 2147104
Horizontal is 1832, depth is 1116059, answer is 2044620088
```
### Day 3
```sh
$ ./aoc2021 --three
The solution for "three" is:
The power rates are gamma: 1143, epsilon: 2952, for 3374136 total
The oxygen rating is 1909 and CO2 rating is 2322, for a life support rating of 4432698
```
### Day 4
```sh
$ ./aoc2021 --four
The solution for "four" is:
The winning score is 668 on call 66. Final score 44088
The last winning score is 263 on call 90. Final score 23670
```
### Day five
```sh
$ ./aoc2021 --five
The solution for "five" is:
There are 5585 overlapping vents
There are 17193 overlapping vents
```