/advent-of-code

Solutions for the Advent of Code

Primary LanguageJavaGNU General Public License v3.0GPL-3.0

Advent of Code

This repository contains my solutions for the Advent of Code programming puzzles. The Advent of Code is an annual event that takes place every December, where a new programming puzzle is released each day leading up to Christmas.

Prerequisites

To run the code in this repository, you'll need to have the following installed on your machine:

  • Java JDK (version 17 or later)
  • Maven (version 3.6 or later)

Setup

  1. Clone the repository to your local machine:
git clone https://github.com/alglus/advent-of-code.git
  1. Navigate to the project root directory:
cd advent-of-code
  1. Build the project using Maven:
mvn clean install

Usage

To run the code for a specific day, use the following command:

mvn exec:java -Dexec.mainClass=aoc<year>.Day<day>
  • <year>: the year of the Advent of Code (e.g., 2022)
  • <day>: the day of the puzzle, with single digits preceded by a zero (e.g., 01)

For example, to run the code for Day 1 of the 2022 event, use the following command:

mvn exec:java -Dexec.mainClass=aoc2022.Day01

The output of the program will be printed to the console.

Testing

To run all tests, use the following command:

mvn test

If you would like to run the tests of a specific day, run:

mvn -Dtest=aoc<year>.Day<day>Tests test

So, for example, to run the tests of Day 2 of the 2022 event, run the following:

mvn -Dtest=aoc2022.Day02Tests test

License

This project is licensed under the GPL-3.0 License - see the LICENSE file for details.