AoC in Kotlin for 2021

Related tags

App AoC2021
Overview

aoc-kotlin-starter

Starter template for solving Advent of Code in Kotlin

Features

  • Gradle setup so you can run a specific day or all days on the command line (see Running below)
  • Timings for each part of each day
  • Input for each day automatically exposed in String and List form
  • Junit and Hamcrest test libraries included (see Testing below)
  • Starter .gitignore

Running

Project is already setup with gradle. To run the app:

  • Navigate to top-level directory on the command line
  • Run ./gradlew run to run all days
  • Run ./gradlew run --args $DAY where $DAY is an integer to run a specific day

Testing

Project includes Junit and Hamcrest and a stub unit test to get you going. To run all tests:

  • Navigate to top-level directory on the command line
  • Run ./gradlew test
  • Add --info, --debug or --stacktrace flags for more output
Test input

By default, instantiations of Day classes in tests will use the input files in src/test/resources, not those in src/main/resources. This hopefully gives you flexibility - you could either just copy the real input into src/test/resources if you want to test the actual answers, or you could add a file of test data based on the examples given on the Advent of Code description for the day. The stub Day1Test class shows a test of the functionality of Day1 where the test input differs from the actual input.

Architecture

  • Inputs go into src/main/resources and follow the naming convention input_day_X.txt
  • Solutions go into src/main/kotlin/days and extend the Day abstract class, calling its constructor with their day number
  • Solutions follow the naming convention DayX
  • It is assumed all solutions will have two parts but share the same input
  • Input is exposed in the solution classes in two forms - inputList and inputString
  • Day 1 solution class and input file are stubbed as a guide on how to extend the project, and how you can use the inputList and inputString mentioned above
  • To get started simply replace src/main/input_day_1.txt with the real input and the solutions in Day1 with your own
  • A Day 1 test class also exists, mostly to show a few hamcrest matchers, and how test input files can differ from actual ones (see Test input section above). To get started with testing you can edit this class, and the input file at src/test/resources/input_day_1.txt
You might also like...
πŸŽ… Marry XMas πŸŽ„ Kotlin solutions for my Advent of Code 2021 🀢

Advent of Code 2021 πŸŽ„ val aMessageFromMe = """ _____________,--, | | | | | | |/ .-.\ HANG IN THERE |_|_|_|_|_|_/ / `. SAN

My 2021 Advent of Code Repo - Kotlin this year!

πŸŽ„ Advent of Code 2021 This year I'll be solving the advent problems using Kotlin! πŸ₯‚ If you're interested in trying out Kotlin for AoC this year or e

Advent of Code 2021, in Kotlin

advent-of-code-kotlin-2021 Welcome to the Advent of Code1 Kotlin project created by mbifulco using the Advent of Code Kotlin Template delivered by Jet

Advent of code 2021 (unofficial) in Kotlin for Educational Plugin on Jetbrains IntelliJ IDE.
Advent of code 2021 (unofficial) in Kotlin for Educational Plugin on Jetbrains IntelliJ IDE.

Kotlin Advent of Code 2021 (unofficial) DISCLAIMER: I am not affiliated with the official Advent of code event or website. To open this course, you ne

Advent of code 2021, Kotlin

aoc-2021-kotlin Welcome to the Advent of Code1 Kotlin project created by almar using the Advent of Code Kotlin Template delivered by JetBrains. In thi

Advent of Code 2021 - Kotlin solution

aoc21-kt Welcome to the Advent of Code1 Kotlin project created by bubblefoil using the Advent of Code Kotlin Template delivered by JetBrains. In this

πŸŽ„ Solutions to Advent of Code 2021 in Kotlin πŸ’œ

Advent of Code 2021 in Kotlin These are my solutions to Advent of Code 2021 using the Kotlin language. Each day has its own subpackage. Try the proble

Solutions to advent of code 2021 in the gen-Z programming language known as kotlin

Advent Of Code 2021 - Kotlin Edition How to run? Get the kotlin SDK using the sdkman tool: https://sdkman.io/sdks#kotlin Run the commands: ./gradlew

Jetbrains advent of code 2021 in kotlin

jetbrains-advent-of-code-2021-in-kotlin Welcome to the Advent of Code1 Kotlin project created by matvs using the Advent of Code Kotlin Template delive

Owner
Joakim H.
Joakim H.
Koltin solutions for the 2021 edition of AoC

AdventOfCode2021 This is the code developed for Advent of Code 2021. My primary goals are: have fun learn something new about Kotlin don't spend more

Norbert Kiesel 0 Dec 1, 2021
Solving all 25 days of the AOC 2021 event here: https://adventofcode.com

advent-of-code-2021-kotlin Welcome to the Advent of Code1 Kotlin project using the Advent of Code Kotlin Template delivered by JetBrains. In this repo

Mofe Ejegi 1 Dec 17, 2021
My solutions for Advent of Code 2021 puzzles, mainly using Kotlin.

Advent of Code 2021 Featuring Kotlin What's that ? https://adventofcode.com/2021/about Advent of Code is an Advent calendar of small programming puzzl

Petrole 0 Dec 2, 2021
My solutions for Advent of Code 2021, written in Kotlin!

Advent-of-Code-2021 Welcome to the Advent of Code1 Kotlin project created by thijsboehme using the Advent of Code Kotlin Template delivered by JetBrai

Thijs Boehme 0 Dec 15, 2021
Kotlin fun with Advent of Code 2021

aoc-kotlin Welcome to the Advent of Code1 Kotlin project created by dayanruben using the Advent of Code Kotlin Template delivered by JetBrains. In thi

Dayan Ruben Gonzalez 32 Dec 15, 2022
Advent of Code 2021 implementations in Kotlin

advent-of-code-in-kotlin-2021 Welcome to the Advent of Code1 Kotlin project created by acrane13 using the Advent of Code Kotlin Template delivered by

null 0 Dec 20, 2021
Advent of Code 2021: Solutions in Kotlin

Advent of Code 2021 Solutions in Kotlin This repo is my personal attempt at solving the Advent of Code 2021 set of problems with the Kotlin programmin

Todd Ginsberg 33 Nov 28, 2022
Advent of Code 2021, using Kotlin

Advent of Code 2021, using Kotlin See https://adventofcode.com/2021, https://kotlinlang.org/. See also "the official GitHub template" by JetBrains. Ge

Stefan Scheidt 3 Nov 18, 2022
Matt Kuhn 2021, Implemented in Kotlin

Advent of Code Matt Kuhn 2021, Implemented in Kotlin

null 3 Dec 30, 2021
Advent of Code 2021 in Kotlin Multiplatform!

Advent of Code 2021 in Kotlin Multiplatform Structure Each day comes with two parts for you to solve. You'll find a ready-to go and test templates to

Martynas PetuΕ‘ka 2 Dec 6, 2021