An open API service indexing awesome lists of open source software.

https://github.com/lmbishop/advent-of-code-2021

My solutions for Advent of Code 2021, written in Kotlin.
https://github.com/lmbishop/advent-of-code-2021

Last synced: 21 days ago
JSON representation

My solutions for Advent of Code 2021, written in Kotlin.

Awesome Lists containing this project

README

          

# Advent of Code 2021

These are my solutions written in Kotlin for Advent of Code 2021.

I am using these challenges mainly to learn and get comfortable with Kotlin 😄. I won't push solutions until the day after.

## Solutions
Since each solution is an entire Gradle submodule, here are quick links to each file:
| Day | Source code | Visualisation | Input |
|-------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------|
| [Day 01](https://adventofcode.com/2021/day/1): Sonar Sweep | [Day01.kt](https://github.com/LMBishop/advent-of-code-2021/blob/master/aoc01/src/main/kotlin/com/leonardobishop/adventofcode/Day01.kt) | - | [input.txt](https://github.com/LMBishop/advent-of-code-2021/blob/master/aoc01/src/main/resources/input.txt) |
| [Day 02](https://adventofcode.com/2021/day/2): Dive! | [Day02.kt](https://github.com/LMBishop/advent-of-code-2021/blob/master/aoc02/src/main/kotlin/com/leonardobishop/adventofcode/Day02.kt) | - | [input.txt](https://github.com/LMBishop/advent-of-code-2021/blob/master/aoc02/src/main/resources/input.txt) |
| [Day 03](https://adventofcode.com/2021/day/3): Binary Diagnostic | [Day03.kt](https://github.com/LMBishop/advent-of-code-2021/blob/master/aoc03/src/main/kotlin/com/leonardobishop/adventofcode/Day03.kt) | - | [input.txt](https://github.com/LMBishop/advent-of-code-2021/blob/master/aoc03/src/main/resources/input.txt) |
| [Day 04](https://adventofcode.com/2021/day/4): Giant Squid | [Day04.kt](https://github.com/LMBishop/advent-of-code-2021/blob/master/aoc04/src/main/kotlin/com/leonardobishop/adventofcode/Day04.kt) | - | [input.txt](https://github.com/LMBishop/advent-of-code-2021/blob/master/aoc04/src/main/resources/input.txt) |
| [Day 05](https://adventofcode.com/2021/day/5): Hydrothermal Venture | [Day05.kt](https://github.com/LMBishop/advent-of-code-2021/blob/master/aoc05/src/main/kotlin/com/leonardobishop/adventofcode/Day05.kt) | - | [input.txt](https://github.com/LMBishop/advent-of-code-2021/blob/master/aoc05/src/main/resources/input.txt) |
| [Day 06](https://adventofcode.com/2021/day/6): Lanternfish | [Day06.kt](https://github.com/LMBishop/advent-of-code-2021/blob/master/aoc06/src/main/kotlin/com/leonardobishop/adventofcode/Day06.kt) | - | [input.txt](https://github.com/LMBishop/advent-of-code-2021/blob/master/aoc06/src/main/resources/input.txt) |
| [Day 07](https://adventofcode.com/2021/day/7): The Treachery of Whales | [Day07.kt](https://github.com/LMBishop/advent-of-code-2021/blob/master/aoc07/src/main/kotlin/com/leonardobishop/adventofcode/Day07.kt) | - | [input.txt](https://github.com/LMBishop/advent-of-code-2021/blob/master/aoc07/src/main/resources/input.txt) |
| [Day 08](https://adventofcode.com/2021/day/8): Seven Segment Search | [Day08.kt](https://github.com/LMBishop/advent-of-code-2021/blob/master/aoc08/src/main/kotlin/com/leonardobishop/adventofcode/Day08.kt) | - | [input.txt](https://github.com/LMBishop/advent-of-code-2021/blob/master/aoc08/src/main/resources/input.txt) |
| [Day 09](https://adventofcode.com/2021/day/9): Smoke Basin | [Day09.kt](https://github.com/LMBishop/advent-of-code-2021/blob/master/aoc09/src/main/kotlin/com/leonardobishop/adventofcode/Day09.kt) | - | [input.txt](https://github.com/LMBishop/advent-of-code-2021/blob/master/aoc09/src/main/resources/input.txt) |
| [Day 10](https://adventofcode.com/2021/day/10): Syntax Scoring | [Day10.kt](https://github.com/LMBishop/advent-of-code-2021/blob/master/aoc10/src/main/kotlin/com/leonardobishop/adventofcode/Day10.kt) | - | [input.txt](https://github.com/LMBishop/advent-of-code-2021/blob/master/aoc10/src/main/resources/input.txt) |
| [Day 11](https://adventofcode.com/2021/day/11): Dumbo Octopus | [Day11.kt](https://github.com/LMBishop/advent-of-code-2021/blob/master/aoc11/src/main/kotlin/com/leonardobishop/adventofcode/Day11.kt) | [Day11Visualisation.kt](https://github.com/LMBishop/advent-of-code-2021/blob/master/aoc11/src/main/kotlin/com/leonardobishop/adventofcode/visualisation/Day11Visualisation.kt) | [input.txt](https://github.com/LMBishop/advent-of-code-2021/blob/master/aoc11/src/main/resources/input.txt) |
| [Day 12](https://adventofcode.com/2021/day/12): Passage Pathing | [Day12.kt](https://github.com/LMBishop/advent-of-code-2021/blob/master/aoc12/src/main/kotlin/com/leonardobishop/adventofcode/Day12.kt) | - | [input.txt](https://github.com/LMBishop/advent-of-code-2021/blob/master/aoc12/src/main/resources/input.txt) |
| [Day 13](https://adventofcode.com/2021/day/12): Transparent Origami | [Day13.kt](https://github.com/LMBishop/advent-of-code-2021/blob/master/aoc13/src/main/kotlin/com/leonardobishop/adventofcode/Day13.kt) | - | [input.txt](https://github.com/LMBishop/advent-of-code-2021/blob/master/aoc13/src/main/resources/input.txt) |

## Building and testing
To clone the repository:
```
$ git clone https://github.com/LMBishop/advent-of-code-2021/
$ cd advent-of-code-2021
```

### Using the helper script
The helper script will build and run the jar for the specified day code.
The working directory will be `work/`, the input file will be copied from the day code.

#### Running normal solutions
```
$ cd work
$ ./build.sh
```

#### Running visualisations
(Only some solutions have visualisations.)
```
$ cd work
$ ./build.sh v
```

### Using Gradle directly

#### Running normal solutions
Linux / macOS:
```
$ ./gradlew build
```
Specific submodule:
```
$ ./gradlew :build
```
Windows:
```
gradlew build
```

#### Running visualisations
Linux / macOS:
```
$ ./gradlew build -Pvisualisation=true
```
Windows:
```
gradlew build -Pvisualisation=true
```

All output jars will be in `build/` of the respective submodules.