Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.
/ aoc21 Public archive

Advent of Code 2021 in the UNIX “little languages”: sh, awk, bc, sed

License

Notifications You must be signed in to change notification settings

sstephenson/aoc21

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This repository contains solutions to the 2021 Advent of Code written in the “little languages” of UNIX.

The solutions run directly from source and are intended to conform to the POSIX.1-2017 standard.

Languages Used

  • sh - shell, the standard command language interpreter
  • awk - pattern scanning and processing language
  • bc - arbitrary-precision arithmetic language
  • sed - stream editor

Solutions

Day 1 Day 2 Day 3 Day 4 Day 5
Day 6 Day 7 Day 8 Day 9 Day 10
Day 11 Day 12 Day 13 Day 14 Day 15
Day 16 Day 17 Day 18 Day 19 Day 20
Day 21 Day 22 Day 23 Day 24 Day 25

Structure

Each solution consists of a main executable file named solve, and optionally additional source files, in a subdirectory of src/ corresponding to the day and problem. The solve program makes the following assumptions about its environment:

  • The TMPDIR environment variable will be set to the path of a writable temporary directory.
  • The current working directory will be set to the parent directory of the solve program.
  • The program will read the day’s input from stdin.
  • The program will write its solution to stdout and exit with a status of zero.

Advent Harness

The repository includes a built-in harness with scripts to fetch advent problem input, record verified output, and stub, run, and test each day’s solutions.

To evaluate a particular solution, run bin/aoc solve <day> <problem>, where <day> is the advent day number and <problem> is 1 or 2.

To test each solution against the recorded output, run bin/aoc test.


© 2021 Sam Stephenson

About

Advent of Code 2021 in the UNIX “little languages”: sh, awk, bc, sed

Topics

Resources

License

Stars

Watchers

Forks