Skip to content

Solutions to the Advent of Code 2024

Notifications You must be signed in to change notification settings

jwong-kps/adventofcode2024

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Advent of Code 2024

This repository contains my solutions to the 2024 version of Advent of Code (https://adventofcode.com/).

This is the first time I am using Kotlin (https://kotlinlang.org/docs/home.html) as I am very much a Java developer by career. There will be a lot of learnings and refactoring as I go along.

I am also using amper (https://github.com/JetBrains/amper/tree/release/0.5) to help drive the project build system, but in this version it is still powered by gradle. It seems to have a simpler project structure compared to the out-of-the-box kotlin project set-up generated by Intellij. There is also a version of amper which can be used as a CLI and then the dependency on the gradle wrapper can be removed.

My approach to these solutions will be about:

  • Kotlin first: This exercise is about learning the features of Kotlin, so I want to take advantage of that rather than relying on what I already know in plain old Java.
  • Verbosity: I never write obfuscated looking code. I like to think the code I write is easy to understand. Also, I'm not the biggest fan of comments unless a line looks complicated or a code block appears in a specific space.
  • Minimal libraries: In my day job, I tend to rely on libraries all the time. However, my intention with these solutions is to not rely on any 3rd party library that is not already part of the Kotlin/Java core.
  • Efficiency: There is a trade-off here against verbosity as efficient/clever pieces of logic do not necessarily lend themselves well to reading and understanding it with ease. However, I will look for optimal solutions where I can.

I hope you enjoy reading. I am always open to constructive feedback.

Running the solutions

You must place your input text files (from the Advent of Code website) in this directory:

./input/day01.txt

And you can put the example input text files here:

./input/examples/day01.txt

At the project root, simply execute on the terminal:

./gradlew run