Welcome to my solutions for the Advent of Code challenges! This repository contains my Java solutions for the puzzles, along with utility classes to streamline the process of solving the challenges.
Advent of Code is an annual programming event in December, where participants solve a series of holiday-themed puzzles. It is a great opportunity to:
- Sharpen programming skills 🛠️
- Explore new algorithms and data structures 🧩
- Having fun and learning new things! 🎉
Mon | Tue | Wed | Thu | Fri | Sat | Sun |
---|---|---|---|---|---|---|
Day 1 ⭐⭐ |
||||||
Day 2 ⭐⭐ |
Day 3 ⭐⭐ |
Day 4 ⭐⭐ |
Day 5 ⭐⭐ |
Day 6 ⭐⭐ |
Day 7 ⭐⭐ |
Day 8 ⭐⭐ |
Day 9 ⭐⭐ |
Day 10 ⭐⭐ |
Day 11 ⭐⭐ |
Day 12 ⭐⭐ |
Day 13 ⭐⭐ |
Day 14 ⭐⭐ |
Day 15 ⭐⭐ |
Day 16 ⭐⭐ |
Day 17 ⭐⭐ |
Day 18 ⭐⭐ |
Day 19 ⭐⭐ |
Day 20 ⭐⭐ |
Day 21 ⭐⭐ |
Day 22 ⭐⭐ |
Day 23 ⭐⭐ |
Day 24 ⭐⭐ |
Day 25 ⭐⭐ |
Year | Day | Title | Difficulty |
---|---|---|---|
2019 | 1 | The Tyranny of the Rocket Equation | ⭐ |
2019 | 2 | 1202 Program Alarm | ⭐⭐ |
2019 | 3 | Crossed Wires | ⭐⭐ |
2019 | 4 | Secure Container | ⭐ |
2019 | ... | ... | ... |
2020 | ... | ... | ... |
2020 | 13 | Shuttle Search | ⭐⭐⭐ |
2020 | ... | ... | ... |
2021 | 1 | Sonar Sweep | ⭐ |
2021 | 2 | Dive! | ⭐ |
2021 | 3 | Binary Diagnostic | ⭐⭐ |
2021 | 4 | Giant Squid | ⭐⭐ |
2021 | 5 | Hydrothermal Venture | ⭐ |
2021 | 6 | Lanternfish | ⭐ |
2021 | 7 | The Treachery of Whales | ⭐ |
2021 | 8 | Seven Segment Search | ⭐⭐⭐ |
2021 | 9 | Smoke Basin | ⭐⭐ |
2021 | 10 | Syntax Scoring | ⭐ |
2021 | 11 | Dumbo Octopus | ⭐ |
2021 | 12 | Passage Pathing | ⭐⭐ |
2021 | 13 | Transparent Origami | ⭐ |
2021 | 14 | Extended Polymerization | ⭐⭐ |
2021 | 15 | Chiton | ⭐⭐ |
2021 | 16 | Packet Decoder | ⭐⭐⭐ |
2021 | 17 | Trick Shot | ⭐⭐ |
2021 | 18 | Snailfish | ⭐⭐⭐⭐ |
2021 | 19 | Beacon Scanner | ⭐⭐⭐⭐ |
2021 | 20 | Trench Map | ⭐⭐ |
2021 | 21 | Dirac Dice | ⭐⭐⭐ |
2022 | ... | ... | ... |
2021 | ... | ... | ... |
2023 | 1 | Trebuchet?! | ⭐⭐ |
2023 | 2 | Cube Conundrum | ⭐ |
2023 | 3 | Gear Ratios | ⭐⭐ |
2023 | 4 | Scratchcards | ⭐ |
2023 | 5 | If You Give A Seed A Fertilizer | ⭐⭐⭐ |
2023 | 6 | Wait For It | ⭐ |
2023 | 7 | Camel Cards | ⭐⭐ |
2023 | 8 | Haunted Wasteland | ⭐⭐ |
2023 | 9 | Mirage Maintenance | ⭐ |
2023 | 10 | Pipe Maze | ⭐⭐⭐⭐ |
2023 | 11 | Cosmic Expansion | ⭐⭐ |
2023 | 12 | Hot Springs | ⭐⭐⭐⭐ |
2023 | 13 | Point of Incidence | ⭐⭐ |
2023 | 14 | Parabolic Reflector Dish | ⭐⭐⭐ |
2023 | 15 | Lens Library | ⭐⭐ |
2023 | 16 | The Floor Will Be Lava | ⭐⭐ |
2023 | 17 | Clumsy Crucible | ⭐⭐⭐ |
2023 | 18 | Lavaduct Lagoon | ⭐⭐⭐⭐ |
2023 | 19 | Aplenty | ⭐⭐ |
2023 | 20 | Pulse Propagation | ⭐⭐⭐⭐ |
2023 | 21 | Step Counter | ⭐⭐⭐⭐⭐ |
2023 | 22 | Sand Slabs | ⭐⭐⭐ |
2023 | 23 | A Long Walk | ⭐⭐⭐⭐ |
2023 | 24 | Never Tell Me The Odds | ⭐⭐⭐⭐ |
2023 | 25 | Snowverload | ⭐⭐⭐⭐ |
2024 | 1 | Historian Hysteria | ⭐ |
2024 | 2 | Red-Nosed Reports | ⭐⭐ |
2024 | 3 | Mull It Over | ⭐⭐ |
2024 | 4 | Ceres Search | ⭐⭐ |
2024 | 5 | Print Queue | ⭐ |
2024 | 6 | Guard Gallivant | ⭐⭐ |
2024 | 7 | Bridge Repair | ⭐⭐⭐ |
2024 | 8 | Resonant Collinearity | ⭐⭐ |
2024 | 9 | Disk Fragmenter | ⭐⭐⭐ |
2024 | 10 | Hoof It | ⭐⭐⭐ |
2024 | 11 | Plutonian Pebbles | ⭐⭐ |
2024 | 12 | Garden Groups | ⭐⭐⭐⭐ |
2024 | 13 | Claw Contraption | ⭐⭐⭐ |
2024 | 14 | Restroom Redoubt | ⭐⭐⭐ |
2024 | 15 | Warehouse Woes | ⭐⭐⭐⭐ |
2024 | 16 | Reindeer Maze | ⭐⭐⭐⭐ |
2024 | 17 | Chronospatial Computer | ⭐⭐⭐⭐⭐ |
2024 | 18 | RAM Run | ⭐⭐⭐ |
2024 | 19 | Linen Layout | ⭐⭐ |
2024 | 20 | Race Condition | ⭐⭐⭐⭐ |
2024 | 21 | Keypad Conundrum | ⭐⭐⭐⭐⭐ |
2024 | 22 | Monkey Market | ⭐⭐⭐⭐ |
2024 | 23 | LAN Party | ⭐⭐⭐ |
2024 | 24 | Crossed Wires | ⭐⭐⭐⭐⭐⭐ |
2024 | 25 | Code Chronicle | ⭐⭐⭐⭐ |
Each day of the challenge is organized into its own directory:
Advent-of-Code/src/main/java/nl/jtepoel/AOC
├───Main.java
│
├───utils
│ Edge.java
│ FrequencySet.java
│ FrequencySetLong.java
│ Graph.java
│ Grid.java
│ Node.java
│ Option.java
│ Pair.java
│ Point.java
│ Quad.java
│ Triple.java
│ Utils.java
│
├───year2019
│ ├───day1
│ │ example.txt
│ │ input.txt
│ │ Main.java
│ │
│ ├───day2
│ │ example.txt
│ │ input.txt
│ │ Main.java
│
├───year----
...
The structure includes:
- Input.txt: Puzzle input for the day.
- Example.txt: Example input for the day.
- Main.java: Java implementation of the solution.
The utils
folder contains utility classes that simplify common tasks during Advent of Code:
Graph.java
: Implements graph data structures and algorithms like BFS/DFS.Edge.java
: Represents edges in graph-based problems.Node.java
: Represents nodes in graph-based problems.Grid.java
: Provides helper methods to navigate and manipulate 2D grids.Point.java
: Represents coordinates or positions in a grid.Pair.java
: Represents a pair of elements.Triple.java
: Represents a triple of elements.Quad.java
: Represents a quadruple of elements.FrequencySet.java
: A set that keeps track of the frequency of elements.FrequencySetLong.java
: A set that keeps track of the frequency of elements (long version).Option.java
: Represents an optional value.Utils.java
: A helper class to streamline creating new challenge days by setting up files and directories.
To run and build this project, you'll need the following:
- Java Development Kit (JDK) 22 or higher
- Maven: A build automation and dependency management tool.
Clone this repository using Git:
git clone https://github.com/J-a-c-c-o/Advent-of-Code.git
cd Advent-of-Code
Use Maven to build the project and resolve dependencies:
mvn clean install
The session token is essential to fetch your personalized puzzle input. Here’s how to set it up:
- Log in to your Advent of Code account.
- Open the browser’s developer tools (F12 or right-click and select Inspect).
- Go to the Application tab.
- Under Storage, find the Cookies section.
- Copy the value of the
session
cookie. - Save the value in a file named
token.txt
in thesrc/main/resources
directory.
Keep your session token secret and never share it publicly!
To automate the process of creating a new day, you can use Main.java
to generate the necessary files and directories.
-
Ensure your token is available: follow the instructions in the Token Configuration section to set up your session token.
-
Run the
Main.java
class:mvn exec:java
After running the class, you will be prompted to select which mode you want to run: Select
create
to create a new day.- It will:
- Create a new directory for the day under the relevant year.
- Fetch the input for the day's puzzle (if the token is valid).
- Generate the necessary files, including
example.txt
,input.txt
, and aMain.java
template.
- It will:
Run the solution using Maven:
mvn exec:java
You will be prompted to select which mode you want to run:
Select run
to run the solution for a specific day.
Big thanks to Advent of Code and its creator, Eric Wastl, for this amazing initiative. 🎉