This repository contains my solutions for the Advent of Code challenges, implemented in Java 17.
src/
├── main/
│ ├── java/
│ │ └── com/
│ │ └── adventofcode/
│ │ ├── annotations/ # Custom annotations
│ │ ├── solutions/year<year>/ # Individual day solutions
│ │ ├── utils/ # Utility classes
│ │ ├── AoCSolution.java
│ │ └── Main.java
│ └── resources/
│ └── inputs/year<year>/ # Puzzle inputs
└── test/
└── java/
└── com/
└── adventofcode/
└── solutions/year<year>/ # Solution tests
- Java 17 or higher
- Maven 3.6 or higher
- Clone the repository:
git clone [your-repository-url]
- Build the project:
mvn clean install
- Run a specific solution:
mvn exec:java -Dexec.args="<year> <day> <part>"
For example, to run 2024 Day 1, Part 1:
mvn exec:java -Dexec.args="2024 1 1"
- Create a new solution class in
src/main/java/com/adventofcode/solutions/year<year>/
- Implement the
AoCSolution
interface - Add the
@Solution
annotation to the solution class - Place your input file in
src/main/resources/inputs/year<year>/
asdayX.txt
- Create corresponding tests in
src/test/java/com/adventofcode/solutions/year<year>/
@Solution(day = 1, year = 2024)
public class Day1Solution implements AoCSolution {
@Override
public String solve(String input, int part) {
return switch (part) {
case 1 -> solvePart1(input);
case 2 -> solvePart2(input);
default -> throw new IllegalArgumentException("Invalid part: " + part);
};
}
private String solvePart1(String input) {
// Implement solution for part 1
return "Not implemented yet";
}
private String solvePart2(String input) {
// Implement solution for part 2
return "Not implemented yet";
}
}
Run all tests:
mvn test
Run tests for a specific day:
mvn test -Dtest=Day1SolutionTest
- Create a new branch for your solution
- Implement your solution and tests
- Ensure all tests pass
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.