advent-of-code

module
v0.0.0-...-ed47123 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2023 License: BSD-3-Clause

README

advent-of-code

Build Status

This repository contains my Go solutions for Advent of Code programming challenges, along with related library code and advent.sh, a shell script that makes various common tasks easier.

Usage

In order for the library code to be able to download input, $HOME/.advent-of-code-session should contain the value of the session cookie that gets set for the .adventofcode.com domain after authenticating with the website. The session needs to be updated every year or two.

I have a function similar to the following declared in my shell (zsh):

advent() {
  case "$1" in
    -h|--help|check|checkall|help|input|run|save|stdin|web)
      $HOME/advent-of-code/advent.sh "$@"
      ;;
    *)
      cd "$($HOME/advent-of-code/advent.sh "$@")"
      ;;
  esac
}

This lets me run various commands like the following:

  • advent today - Move to the directory for today's puzzle.
  • advent web - Open today's puzzle in a web browser.
  • advent run - Run main.go in the current directory with real input.
  • advent stdin <example.txt - Run main.go with other input.
  • advent input - Print today's input.
  • advent save - Run main.go and save its output under answers/.
  • advent check - Run main.go and compare its output against saved output.

The original puzzles and corresponding text (portions of which are sometimes quoted within comments in my solutions) are copyrighted by Advent of Code. From https://adventofcode.com/about:

Advent of Code is a registered trademark in the United States. The design elements, language, styles, and concept of Advent of Code are all the sole property of Advent of Code and may not be replicated or used by any other person or entity without express written consent of Advent of Code. Copyright 2015-2022 Advent of Code. All rights reserved.

You may link to or reference puzzles from Advent of Code in discussions, classes, source code, printed material, etc., even in commercial contexts. Advent of Code does not claim ownership or copyright over your solution implementation.

Directories

Path Synopsis
2015
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
2016
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
2017
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
2018
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
2019
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
2020
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
2021
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
2022
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
2023
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Package lib contains a random assortment of code useful for solving Advent of Code challenges.
Package lib contains a random assortment of code useful for solving Advent of Code challenges.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL