An open API service indexing awesome lists of open source software.

https://github.com/code-shoily/adventoffsharp

Advent of Code puzzles solved in F#
https://github.com/code-shoily/adventoffsharp

advent-of-code algorithms fsharp programming-challenges

Last synced: about 18 hours ago
JSON representation

Advent of Code puzzles solved in F#

Awesome Lists containing this project

README

          

# Advent of Code solutions with F#

## What is Advent of Code?

[This](https://adventofcode.com). Every year since 2015, starting December 1 to 25, 25 small programming problems are
presented on http://adventofcode.com. The challenges are fun to solve in programming language of your choice.

This is my attempt to solve Advent of Code problems with [F#](https://fsharp.org/).

More about Advent of Code [here](https://adventofcode.com/about).

> **55 problems solved** across **10 years** — [Tags](wiki/tags/index.md) · [Difficulty](wiki/difficulty.md)

**Years:** [2015](Year2015/README.md) | [2016](Year2016/README.md) | [2017](Year2017/README.md) | [2018](Year2018/README.md) | [2019](Year2019/README.md) | [2020](Year2020/README.md) | [2021](Year2021/README.md) | [2022](Year2022/README.md) | [2023](Year2023/README.md) | [2024](Year2024/README.md)

| Day | [2015](Year2015/README.md) | [2016](Year2016/README.md) | [2017](Year2017/README.md) | [2018](Year2018/README.md) | [2019](Year2019/README.md) | [2020](Year2020/README.md) | [2021](Year2021/README.md) | [2022](Year2022/README.md) | [2023](Year2023/README.md) | [2024](Year2024/README.md) |
|:---:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
| 1 | [⭐](https://adventofcode.com/2015/day/1) | [⭐](https://adventofcode.com/2016/day/1) | [⭐](https://adventofcode.com/2017/day/1) | [⭐](https://adventofcode.com/2018/day/1) | [⭐](https://adventofcode.com/2019/day/1) | [⭐](https://adventofcode.com/2020/day/1) | [⭐](https://adventofcode.com/2021/day/1) | [⭐](https://adventofcode.com/2022/day/1) | [⭐](https://adventofcode.com/2023/day/1) | [⭐](https://adventofcode.com/2024/day/1) |
| 2 | [⭐](https://adventofcode.com/2015/day/2) | [⭐](https://adventofcode.com/2016/day/2) | [⭐](https://adventofcode.com/2017/day/2) | [⭐](https://adventofcode.com/2018/day/2) | [⭐](https://adventofcode.com/2019/day/2) | [⭐](https://adventofcode.com/2020/day/2) | [⭐](https://adventofcode.com/2021/day/2) | [⭐](https://adventofcode.com/2022/day/2) | [⭐](https://adventofcode.com/2023/day/2) | [⭐](https://adventofcode.com/2024/day/2) |
| 3 | [⭐](https://adventofcode.com/2015/day/3) | [⭐](https://adventofcode.com/2016/day/3) | [⭐](https://adventofcode.com/2017/day/3) | [⭐](https://adventofcode.com/2018/day/3) | [⭐](https://adventofcode.com/2019/day/3) | [⭐](https://adventofcode.com/2020/day/3) | [⭐](https://adventofcode.com/2021/day/3) | [⭐](https://adventofcode.com/2022/day/3) | [⭐](https://adventofcode.com/2023/day/3) | [⭐](https://adventofcode.com/2024/day/3) |
| 4 | [⭐](https://adventofcode.com/2015/day/4) | [⭐](https://adventofcode.com/2016/day/4) | [⭐](https://adventofcode.com/2017/day/4) | [⭐](https://adventofcode.com/2018/day/4) | | [⭐](https://adventofcode.com/2020/day/4) | | | | [⭐](https://adventofcode.com/2024/day/4) |
| 5 | [⭐](https://adventofcode.com/2015/day/5) | [⭐](https://adventofcode.com/2016/day/5) | [⭐](https://adventofcode.com/2017/day/5) | | | [⭐](https://adventofcode.com/2020/day/5) | | | | [⭐](https://adventofcode.com/2024/day/5) |
| 6 | [⭐](https://adventofcode.com/2015/day/6) | [⭐](https://adventofcode.com/2016/day/6) | [⭐](https://adventofcode.com/2017/day/6) | | | [⭐](https://adventofcode.com/2020/day/6) | | | | [⭐](https://adventofcode.com/2024/day/6) |
| 7 | | [⭐](https://adventofcode.com/2016/day/7) | [⭐](https://adventofcode.com/2017/day/7) | [⭐](https://adventofcode.com/2018/day/7) | | [⭐](https://adventofcode.com/2020/day/7) | | | | [⭐](https://adventofcode.com/2024/day/7) |
| 8 | | | | | | | | | | [⭐](https://adventofcode.com/2024/day/8) |
| 9 | | | | | | | | | | |
| 10 | | | | | | | | | | [⭐](https://adventofcode.com/2024/day/10) |
| 11 | | | | | | | | | | [⭐](https://adventofcode.com/2024/day/11) |
| 12 | | | | | | | | | | |
| 13 | | | | | | | | | | |
| 14 | | | | | | | | | | |
| 15 | | | | | | | | | | |
| 16 | | | | | | | | | | |
| 17 | | | | | | | | | | |
| 18 | | | | | | | | | | |
| 19 | | | | | | | | | | |
| 20 | | | | | | | | | | |
| 21 | | | | | | | | | | |
| 22 | | | | | | | | | | |
| 23 | | | | | | | | | | |
| 24 | | | | | | | | | | |
| 25 | | | | | | | | | | [⭐](https://adventofcode.com/2024/day/25) |

### 🏷️ Tags

[array](wiki/tags/array.md) `5` [geometry](wiki/tags/geometry.md) `5` [navigation](wiki/tags/navigation.md) `5` [set](wiki/tags/set.md) `4` [string](wiki/tags/string.md) `4` [frequency](wiki/tags/frequency.md) `3` [graph](wiki/tags/graph.md) `3` [slow](wiki/tags/slow.md) `3` [ascii](wiki/tags/ascii.md) `2` [md5](wiki/tags/md5.md) `2` [mutable](wiki/tags/mutable.md) `2` [recursion](wiki/tags/recursion.md) `2` [reduction](wiki/tags/reduction.md) `2` [regex](wiki/tags/regex.md) `2` [should-refactor](wiki/tags/should-refactor.md) `2` [slightly-slow](wiki/tags/slightly-slow.md) `2` [sort](wiki/tags/sort.md) `2` [topological-sort](wiki/tags/topological-sort.md) `2` [anagram](wiki/tags/anagram.md) `1` [arithmetic](wiki/tags/arithmetic.md) `1` [array2d](wiki/tags/array2d.md) `1` [bfs](wiki/tags/bfs.md) `1` [bignum](wiki/tags/bignum.md) `1` [binary](wiki/tags/binary.md) `1` [brute-force](wiki/tags/brute-force.md) `1` [counter](wiki/tags/counter.md) `1` [data-modeling](wiki/tags/data-modeling.md) `1` [data-transform](wiki/tags/data-transform.md) `1` [date-time](wiki/tags/date-time.md) `1` [dfs](wiki/tags/dfs.md) `1` [difficult-part-2](wiki/tags/difficult-part-2.md) `1` [direction](wiki/tags/direction.md) `1` [disjoint-set](wiki/tags/disjoint-set.md) `1` [equation](wiki/tags/equation.md) `1` [fold](wiki/tags/fold.md) `1` [formula](wiki/tags/formula.md) `1` [fsm](wiki/tags/fsm.md) `1` [graph-traversal](wiki/tags/graph-traversal.md) `1` [grid](wiki/tags/grid.md) `1` [map-grid](wiki/tags/map-grid.md) `1` [matrix](wiki/tags/matrix.md) `1` [memoization](wiki/tags/memoization.md) `1` [modular-algebra](wiki/tags/modular-algebra.md) `1` [n-sum](wiki/tags/n-sum.md) `1` [off-by-one](wiki/tags/off-by-one.md) `1` [optimization](wiki/tags/optimization.md) `1` [scan](wiki/tags/scan.md) `1` [sequence](wiki/tags/sequence.md) `1` [simulation](wiki/tags/simulation.md) `1` [sliding-window](wiki/tags/sliding-window.md) `1` [slope-intercept](wiki/tags/slope-intercept.md) `1` [spiral](wiki/tags/spiral.md) `1` [tabular](wiki/tags/tabular.md) `1` [transpose](wiki/tags/transpose.md) `1` [typed](wiki/tags/typed.md) `1` [validation](wiki/tags/validation.md) `1` [window](wiki/tags/window.md) `1`

## Running Solutions

### Prerequisites

- [.NET 10.0 SDK](https://dotnet.microsoft.com/download/dotnet/10.0)
- [AOC_SESSION_KEY](#getting-your-session-key) environment variable (optional, for fetching inputs)

### Running a specific day

```bash
dotnet run --project Runner --
```

Example:
```bash
dotnet run --project Runner -- 2024 1
```

### Running tests

```bash
dotnet test
```

## Project Structure

```
AdventOfFSharp/
├── Year20XX/ # Solutions for each year
│ ├── Day01.fs
│ ├── Day02.fs
│ └── ...
├── Common/ # Shared utilities
├── Inputs/ # Puzzle inputs (not in repo)
├── Solutions.Tests/ # Unit tests
└── scripts/ # Helper scripts
├── gen_wiki.py # Generate wiki documentation
└── scaffold.py # Scaffold new day files
```

## Scripts

### Generate Wiki

Generates wiki documentation from solution headers:

```bash
python scripts/gen_wiki.py
```

This creates:
- `wiki/difficulty.md` — solutions by difficulty
- `wiki/tags/index.md` — tag directory
- `wiki/tags/{tag}.md` — per-tag pages
- `YearXXXX/README.md` — per-year tables

### Scaffold New Day

Creates boilerplate for a new day:

```bash
python scripts/scaffold.py
```

Example:
```bash
python scripts/scaffold.py 2024 15
```

This creates:
- `Year2024/Day15.fs` — solution module
- `Inputs/2024_15.txt` — input file (fetched if AOC_SESSION_KEY is set)

## Getting your session key

1. Log in to [Advent of Code](https://adventofcode.com)
2. Open browser dev tools → Application/Storage → Cookies
3. Copy the `session` cookie value
4. Set it as environment variable:
```bash
export AOC_SESSION_KEY="your_session_cookie"
```