/advent-of-code-2023

Simple framework for writing multilingual solutions for Advent of Code

Primary LanguagePythonMIT LicenseMIT

Multilingual Advent of Code 2023

Python C++

Advent of Code is a great opportunity to brush up on existing languages and learn some new ones!

Usage - Directory Structure - Extending Language Support

Usage

$ ./run.sh
usage: ./run.sh LANGUAGE DAY PART INPUT_TYPE

arguments:
  LANGUAGE     the programming language
  DAY          the day of a problem, day{01..25}
  PART         the part of a problem, part{1,2}
  INPUT_TYPE   type of input file
$ ./dev.sh
usage: ./dev.sh LANGUAGE

arguments:
  LANGUAGE     the programming language

Examples

Run the Python solution for part 1 of day 2's problem, using the sample-1.in input:

$ ./run.sh python day02 part1 sample-1

Open a development container for working on C++ solutions:

$ ./dev.sh cpp

Directory structure

File / Directory Description
data/dayXX/sample-1.in Sample input for part 1 of dayXX
data/dayXX/sample-2.in Sample input for part 2 of dayXX
data/dayXX/test.in Test input for dayXX
drivers/LANG Build context and solution for LANG
dev.sh Multilingual development container launcher
run.sh Multilingual solution dispatcher

Extending language support

# 1.
# Create a driver subdirectory for the new language.
$ mkdir drivers/golang

# 2.
# Implement a Dockerfile with a base image for the new language,
# and sets '/workarea' as the WORKDIR.
$ cat drivers/golang/Dockerfile

# 3.
# Create an executable 'run.sh' file that expects to be invoked with
# './run.sh day{01..25} part{1..2} sample|test'.
$ cat drivers/golang/run.sh