WVerlaek / adventofcode

Advent of Code solutions written in Kotlin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Advent of Code

https://adventofcode.com/

Open in Gitpod

Advent of Code solutions, written in Kotlin.

Solution framework

A small framework is created to speed up solving a day's puzzle:

  • Input is automatically read from the AoC API
  • Unit tests using each day's sample input to verify solutions
  • Answers are automatically uploaded and outcome is shown
  • Common package for utitilities and datastructures

Additionally, uses IntelliJ live templates:

  • Template to solve a day's puzzle
  • Template to unit test a solution with sample input

Or, run the following to generate a source + test file for a new day:

./workflow/new.sh <day> [<year>]

A GitHub Action is configured to run all unit tests on each commit.

Automatic answer submission

Using a session token for the Advent of Code API, the day's input is automatically read, and your solution is uploaded on each run with the outcome printed afterwards:

$ gradle run
Answer for 2022/3 level 2: '2581' (took 28ms)
Response: right answer!

No need to manually download inputs and upload your answers ⚡

Set up API session token

The session token needed to read input and upload answers can be set up as follows:

  • Log in on https://adventofcode.com/
  • Read the session cookie
  • Put its value in this file: .secrets/session (.gitignored)
    • Or set it as env var AOC_SESSION, e.g. in the Gitpod user settings to have it automatically used in Gitpod workspaces.

About

Advent of Code solutions written in Kotlin


Languages

Language:Kotlin 99.6%Language:Shell 0.4%