Skip to content

πŸŽ„ A Kotlin template for Advent of Code, complete with a CLI.

Notifications You must be signed in to change notification settings

MoritzHayden/advent-of-code-kotlin-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Advent of Code - Kotlin Template

A Kotlin template for Advent of Code, complete with a CLI.

Table of Contents

  1. How To Run
  2. Util Functions

How To Run

  1. Click Use this template to create your own repository
  2. Clone your new repository to your local machine
  3. Create a new configuration in IntelliJ IDEA and set MainKt as the main class
    • You may need to download any missing dependencies like OpenJDK or Kotlin, but IntelliJ IDEA will help you with this
  4. For each day, write your solution in the respective class in the src/days folder
  5. Run your project and have fun!

Util Functions

The src/Utils.kt file contains some helpful methods from JetBrains that you can use in your solutions.

  • The readFile(name: String) function takes in a file name and returns a List. For example:
    var count = 0
    val input = readFile("Day01").map { it.toInt() }
    for (i in 1 until input.size) {
        if (input[i] > input[i-1]) {
            count++
        }
    }
    
  • The String.md5() function is an extension method on the String class that transforms a string into a md5 hash. For example:
    if ("This is a test string".md5() == "c639efc1e98762233743a75e7798dd9c") {
            // This is true
    }
    

About

πŸŽ„ A Kotlin template for Advent of Code, complete with a CLI.

Topics

Resources

Stars

Watchers

Forks

Languages