Home

Awesome

Advent of Code Kotlin - Project Template

This is a self-contained starter project template for solving Advent of Code puzzles in Kotlin! It uses AocKt and Kotest to minimize boilerplate and provide a smooth development experience.

🏗️ Use This Template

  1. Make sure you're logged in to GitHub
  2. Click the green Use this template button (not fork!).
  3. Select Create a new repository.
  4. Choose yourself as the owner, a descriptive name, and a visibility(*).
  5. Click Create repository.
  6. Clone your repository, and open the project with IntelliJ IDEA.
  7. Solve puzzles!

[!CAUTION] (*) DO NOT Commit Puzzle Inputs On Public Repos!

It is against the rules to redistribute your puzzle inputs!

Inputs are intentionally git-ignored by default. This means that you would have to re-download your inputs and solutions every time you clone from a different machine. To avoid that, use something like git-crypt to ensure inputs can only be read by you if you plan on sharing your repository publicly.

📝 Workflow Example

A step-by-step tutorial workflow is documented here.

It covers:

▶️ Running your Code

From IntelliJ (Recommended)

If you have the Kotest Plugin installed, the IDE will show a 'Run' gutter icon near any AdventSpec in your code. After that, you can re-run the same test using Ctrl+F5, or pressing the Rerun button in the test tool window. This provides the most comfortable feedback loop when solving new problems. You may also run tests in bulk by right clicking on a test package.

From Gradle / CLI

You can also run your tests from Gradle.

To run a specific test, pass it via its FQN:

./gradlew test --tests 'aockt.y9999.Y9999D01Test'

You may also filter and run tests in bulk. For example, running all tests within the same year package:

./gradlew test --tests 'aockt.y9999.*'

If for whatever reason you want to run tests in bulk but skip the parts that have been marked as expensive, you can filter them out as well:

./gradlew test -Dkotest.tags='!Expensive'