Skip to content

Advent of code in Typescript/TS, rust, and other languages

Notifications You must be signed in to change notification settings

EagleLizard/advent-of-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EagleLizard - Advent of Code

Overview

This repository contains Advent of Code solutions by EagleLizard.

Table of Contents

  1. AoC 2023
    1. Typescript + NodeJS
      1. Prerequisites
      2. Getting Started
      3. Running the Code
    2. Rust
      1. Prerequisites
      2. Getting Started
      3. Running the Code
    3. C++
      1. Prerequisites
      2. Getting Started
      3. Running the Code

AoC 2023

Advent of Code 2023 solutions are in the ./2023 directory.

Solutions are created in Typescript + NodeJS and Rust.

Typescript + NodeJS

It's recommended to use nvm to manage node and npm versions.

Prerequisites

  • NodeJS @ v21.4.0
  • Typescript @ v5.3.2

Getting Started

In the 2023 directory, install dependencies:

npm i

If you have typescript installed globally, run:

tsc

Otherwise, you can prefix the command with npx to use the binary installed in node_modules:

npx tsc

To run the compiler in watch mode:

tsc -w

Running the Code

After compiling, the transpiled JS code will be in the dist folder.

Run the program by executing the main.js file with node:

node dist/main.js

Rust

It's recommended to use rustup to manage versions, see Rust's official Getting Started page for installation instructions.

Prerequisites

  • cargo @ 1.72.1

To use the Makefile and run the project in watch mode, install cargo-watch:

cargo install cargo-watch

Getting Started

In the 2023 directory, run:

cargo build

Running the Code

If you built the executable already via the previous section, you can run:

./target/debug/aoc2023

Alternatively, you can build and run the project using:

cargo watch -x run

You can also run in watch mode using:

make watch

C++

On MacOS, uses g++ which is an alias to clang.

Prerequisites

  • cmake @ 3.27.7
  • fswatch @ 1.17.1

To use the Makefile and run the project in watch mode, install fswatch:

brew install fswatch

Getting Started

In the 2023 directory, run:

make build-cpp

Running the Code

If you built the executable already via the previous section, you can run:

./cpp-out/aoc2023cpp

Alternatively, you can build and run the project using:

make run-cpp

You can also run in watch mode using:

make watch-cpp