1
0
mirror of https://github.com/chylex/Advent-of-Code.git synced 2025-05-17 13:34:03 +02:00
My solutions to https://adventofcode.com.
Go to file
2022-12-03 18:25:35 +01:00
2015 Move and rename input files 2022-12-03 04:51:10 +01:00
2020 Move and rename input files 2022-12-03 04:51:10 +01:00
2021 Move and rename input files 2022-12-03 04:51:10 +01:00
2022 Add 2022 - Day 3 - Part 1 2022-12-03 18:25:35 +01:00
.gitattributes Add .gitattributes to force LF 2022-12-03 01:09:07 +01:00
LICENSE Initial commit 2021-11-30 01:22:59 +01:00
README.md Add 2022 - Day 3 - Part 1 2022-12-03 18:25:35 +01:00

These are my solutions to Advent of Code puzzles!

This repository is likely going to be an utter mess of programming languages. If you're interested, read below for the list of used languages, and instructions to get them working on your machine.

Years and days are organized in folders. Every day contains a source code file named main with the solution, and the input file input.txt. Some years also contain a utils folder with shared code used in each day (usually to read the input file).

The solutions always look for the input file in the working directory, so make sure the working directory is set to the day's folder.

If you use JetBrains IDEs, you can open each year's folder in the appropriate IDE. I have included a Run Configuration for each solved day, so you should see them in the Run/Debug Configurations menu.

Languages

[2022] Python

The 2022 folder does not have any special project. You can run the main.py file in each day's folder directly using Python 3.11 or newer (older versions may also work, but this is not guaranteed).

You should be able to load the 2022 folder into PyCharm.

[2021] Kotlin

The 2021 folder contains a Gradle project (build.gradle.kts) that sets up every day as a source root and task that can be launched with gradlew <day> (for ex. gradlew 01).

You should be able to load the Gradle project into IntelliJ IDEA.

[2020] Rust

The 2020 folder contains a Cargo project (Cargo.toml) that sets up every day as a binary target that can be launched with cargo run --bin <day> (for ex. cargo run --bin 01).

You should be able to load the Cargo project into CLion.

[2015] NASM x64 Assembly

The 2015 folder contains a CMake project (CMakeLists.txt), which sets up every day as a CMake subproject.

You should be able to load the CMake project into CLion, as long as you have a toolchain named Visual Studio x64 set to use the amd64 architecture.

The entry point is in utils/main.c, which reads the whole input file into a buffer and passes it as a parameter to the entryPoint function defined in each day's main.asm.

Note that everything is targeted for Windows and assembly is not portable, so running on a different OS will most likely require some changes. To compile the code on Windows, you will need to:

  1. Install Visual Studio with MSVC x64/x86 Build Tools
  2. Install NASM (the "Executable only" version will suffice, as long as you setup the system %PATH% environment variable to include the folder with nasm.exe)

The versions should not matter, but I used Visual Studio 2019 with MSVC v142 (14.29) and NASM 2.15.05.

Solved Days

Year Day Language / Year Day Language / Year Day Language
2015 01 NASM x64 / 2020 01 Rust / 2021 01 Kotlin
2015 02 NASM x64 / 2020 02 Rust / 2021 02 Kotlin
2015 03 NASM x64 / 2020 03 Rust / 2021 03 Kotlin
/ 2020 04 Rust / 2021 04 Kotlin
/ 2020 05 Rust / 2021 05 Kotlin
/ 2020 06 Rust / 2021 06 Kotlin
/ 2020 07 Rust / 2021 07 Kotlin
/ 2020 08 Rust / 2021 08 Kotlin
Year Day Language
2022 01 Python
2022 02 Python
2022 03 Python