Skip to content

Commit 6ab8b04

Browse files
committed
Update README
1 parent d4478a7 commit 6ab8b04

2 files changed

Lines changed: 29 additions & 8 deletions

File tree

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
<!--
2-
* AUTOGENERATED -- DO NOT EDIT
3-
* Edit static content in `priv/partials/readme_content.md`
4-
* Run `mix gen_readme` to recreate
5-
-->
61
# AdventOfCode
72

83
Advent of Code puzzle solutions in Elixir. It's work in progress and starting year 2015 to 2022, random days are attempted.
@@ -13,7 +8,7 @@ All solution modules reside in `lib/<year>/day_<day>.ex` and associated tests ha
138

149
## Stubs
1510

16-
To make the experience boilerplate-free and give all solutions uniform (more or less) structure, type `mix gen --year <year> --day <day>` or `mix gen <year> <day>` to have the structure and stub generated. Optionally, if you have `COOKIE` environment variable storing your cookie then it will download the input file and add the title on the moduledocs for you. Type `mix help gen` for more.
11+
To make the experience boilerplate-free and give all solutions uniform (more or less) structure, type `mix gen --year <year> --day <day>` or `mix gen <year> <day>` to have the structure and stub generated. Optionally, if you have `AOC_SESSION_KEY` environment variable storing your cookie then it will download the input file and add the title on the moduledocs for you. Type `mix help gen` for more.
1712

1813
To solve the problem for a particular year/day, type in `mix solve --year <year> --day <day>` or `mix solve <year> <day>` and you will see the result of the mentioned `year/day` if it is valid and has been solved. Type `mix help solve` for more.
1914

@@ -23,14 +18,24 @@ During December 1 of a new year (if Advent of Code is happening that year), the
2318

2419
* Create a new folder `XXXX` (in year format) under `/lib` or `/test`
2520
* Update the `@latest_year` attribute on `advent_of_code.ex`
26-
* Double check your session cookie (in case you're using it)
21+
* Double check your session cookie `AOC_SESSION_KEY` (in case you're using it)
2722

2823
All commands should work from then on.
2924

3025
## Testing
3126

3227
run `mix test` to ensure all solutions are working okay. To run test for a particular year and day, type `mix test --only y<last-two-digits-of-year><zero-padded-day>`. For example: `mix test --only y1501` tests for `2015` as year and `1` as day.
3328

29+
## Benchmarking
30+
31+
To benchmark solutions and update the [Benchmarks](BENCHMARKS.md) report, use the provided script:
32+
33+
- `scripts/gen_benchmark.py`: Runs all solved problems across all years.
34+
- `scripts/gen_benchmark.py <year>`: Benchmarks all days for a specific year.
35+
- `scripts/gen_benchmark.py <year> <day>`: Benchmarks a single problem (useful after a new solve).
36+
37+
The script saves results to a persistent JSON file at `priv/data/benchmark.json`, allowing you to update specific results without re-running everything.
38+
3439
## Updating README and Stats
3540

3641
If you want to update the `README.md` (i.e. this file) please do not update `README.me` directly, instead update the static content (not stats related) on `priv/partials/readme_content.md` and then run `mix readme` to regenerate this file.
@@ -75,4 +80,3 @@ Note: All files mentioned above are autogenerated and are created by running `py
7580
[graph](wiki/tags/graph.md)&nbsp;`35` [grid](wiki/tags/grid.md)&nbsp;`34` [sequence](wiki/tags/sequence.md)&nbsp;`26` [set](wiki/tags/set.md)&nbsp;`17` [simulation](wiki/tags/simulation.md)&nbsp;`16` [op-code](wiki/tags/op-code.md)&nbsp;`12` [geometry2d](wiki/tags/geometry2d.md)&nbsp;`11` [optimization](wiki/tags/optimization.md)&nbsp;`10` [recursion](wiki/tags/recursion.md)&nbsp;`8` [reduction](wiki/tags/reduction.md)&nbsp;`8` [walk](wiki/tags/walk.md)&nbsp;`7` [arithmetic](wiki/tags/arithmetic.md)&nbsp;`6` [bitwise](wiki/tags/bitwise.md)&nbsp;`6` [dynamic-programming](wiki/tags/dynamic-programming.md)&nbsp;`6` [memoization](wiki/tags/memoization.md)&nbsp;`6` [validation](wiki/tags/validation.md)&nbsp;`6` [count](wiki/tags/count.md)&nbsp;`5` [regex](wiki/tags/regex.md)&nbsp;`5` [dijkstra](wiki/tags/dijkstra.md)&nbsp;`4` [implicit-graph](wiki/tags/implicit-graph.md)&nbsp;`4` [map](wiki/tags/map.md)&nbsp;`4` [matrix](wiki/tags/matrix.md)&nbsp;`4` [modular-arithmetic](wiki/tags/modular-arithmetic.md)&nbsp;`4` [parse-heavy](wiki/tags/parse-heavy.md)&nbsp;`4` [range](wiki/tags/range.md)&nbsp;`4` [shortest-path](wiki/tags/shortest-path.md)&nbsp;`4` [sliding-window](wiki/tags/sliding-window.md)&nbsp;`4` [slow](wiki/tags/slow.md)&nbsp;`4` [annoying](wiki/tags/annoying.md)&nbsp;`3` [connectivity](wiki/tags/connectivity.md)&nbsp;`3` [hash](wiki/tags/hash.md)&nbsp;`3` [md5](wiki/tags/md5.md)&nbsp;`3` [measurement](wiki/tags/measurement.md)&nbsp;`3` [number-theory](wiki/tags/number-theory.md)&nbsp;`3` [random-access](wiki/tags/random-access.md)&nbsp;`3` [rotation](wiki/tags/rotation.md)&nbsp;`3` [sort](wiki/tags/sort.md)&nbsp;`3` [stack](wiki/tags/stack.md)&nbsp;`3` [traversal](wiki/tags/traversal.md)&nbsp;`3` [visual-result](wiki/tags/visual-result.md)&nbsp;`3` [a-star](wiki/tags/a-star.md)&nbsp;`2` [assembunny](wiki/tags/assembunny.md)&nbsp;`2` [atomics](wiki/tags/atomics.md)&nbsp;`2` [bfs](wiki/tags/bfs.md)&nbsp;`2` [calculation](wiki/tags/calculation.md)&nbsp;`2` [checksum](wiki/tags/checksum.md)&nbsp;`2` [circular-linked-list](wiki/tags/circular-linked-list.md)&nbsp;`2` [combinatorics](wiki/tags/combinatorics.md)&nbsp;`2` [cycle-detection](wiki/tags/cycle-detection.md)&nbsp;`2` [cycles](wiki/tags/cycles.md)&nbsp;`2` [data-modelling](wiki/tags/data-modelling.md)&nbsp;`2` [emulation](wiki/tags/emulation.md)&nbsp;`2` [flood-fill](wiki/tags/flood-fill.md)&nbsp;`2` [fsm](wiki/tags/fsm.md)&nbsp;`2` [geometry3d](wiki/tags/geometry3d.md)&nbsp;`2` [hexagon](wiki/tags/hexagon.md)&nbsp;`2` [int-code](wiki/tags/int-code.md)&nbsp;`2` [interval-merging](wiki/tags/interval-merging.md)&nbsp;`2` [json](wiki/tags/json.md)&nbsp;`2` [large-number](wiki/tags/large-number.md)&nbsp;`2` [linked-list](wiki/tags/linked-list.md)&nbsp;`2` [math](wiki/tags/math.md)&nbsp;`2` [pattern-matching](wiki/tags/pattern-matching.md)&nbsp;`2` [routing](wiki/tags/routing.md)&nbsp;`2` [state-space](wiki/tags/state-space.md)&nbsp;`2` [state-space-search](wiki/tags/state-space-search.md)&nbsp;`2` [string](wiki/tags/string.md)&nbsp;`2` [string-encoding](wiki/tags/string-encoding.md)&nbsp;`2` [table-lookup](wiki/tags/table-lookup.md)&nbsp;`2` [topological-sort](wiki/tags/topological-sort.md)&nbsp;`2` [vector](wiki/tags/vector.md)&nbsp;`2` [algebra](wiki/tags/algebra.md)&nbsp;`1` [ambiguous-solution](wiki/tags/ambiguous-solution.md)&nbsp;`1` [assembled-optimization](wiki/tags/assembled-optimization.md)&nbsp;`1` [binary-search](wiki/tags/binary-search.md)&nbsp;`1` [binary-space](wiki/tags/binary-space.md)&nbsp;`1` [bitmask](wiki/tags/bitmask.md)&nbsp;`1` [bron-kerbosch](wiki/tags/bron-kerbosch.md)&nbsp;`1` [cellular-automata](wiki/tags/cellular-automata.md)&nbsp;`1` [char-sequence](wiki/tags/char-sequence.md)&nbsp;`1` [chinese-remainder](wiki/tags/chinese-remainder.md)&nbsp;`1` [circular-buffer](wiki/tags/circular-buffer.md)&nbsp;`1` [circular-list](wiki/tags/circular-list.md)&nbsp;`1` [clique](wiki/tags/clique.md)&nbsp;`1` [concurrency](wiki/tags/concurrency.md)&nbsp;`1` [concurrent](wiki/tags/concurrent.md)&nbsp;`1` [constellation](wiki/tags/constellation.md)&nbsp;`1` [dag](wiki/tags/dag.md)&nbsp;`1` [dataflow](wiki/tags/dataflow.md)&nbsp;`1` [date-time](wiki/tags/date-time.md)&nbsp;`1` [disjoint-set](wiki/tags/disjoint-set.md)&nbsp;`1` [double-parse](wiki/tags/double-parse.md)&nbsp;`1` [floyd-warshall](wiki/tags/floyd-warshall.md)&nbsp;`1` [game](wiki/tags/game.md)&nbsp;`1` [gb-tree](wiki/tags/gb-tree.md)&nbsp;`1` [generation](wiki/tags/generation.md)&nbsp;`1` [graph-route](wiki/tags/graph-route.md)&nbsp;`1` [greedy](wiki/tags/greedy.md)&nbsp;`1` [grid2d](wiki/tags/grid2d.md)&nbsp;`1` [hard-description](wiki/tags/hard-description.md)&nbsp;`1` [infinite-grid](wiki/tags/infinite-grid.md)&nbsp;`1` [infinite-sequence](wiki/tags/infinite-sequence.md)&nbsp;`1` [inline-input](wiki/tags/inline-input.md)&nbsp;`1` [lan-party](wiki/tags/lan-party.md)&nbsp;`1` [lcm](wiki/tags/lcm.md)&nbsp;`1` [list](wiki/tags/list.md)&nbsp;`1` [logic-circuit](wiki/tags/logic-circuit.md)&nbsp;`1` [logic-gates](wiki/tags/logic-gates.md)&nbsp;`1` [longest-path](wiki/tags/longest-path.md)&nbsp;`1` [manual-parse](wiki/tags/manual-parse.md)&nbsp;`1` [mask](wiki/tags/mask.md)&nbsp;`1` [maximum-clique](wiki/tags/maximum-clique.md)&nbsp;`1` [min-cut](wiki/tags/min-cut.md)&nbsp;`1` [number-system](wiki/tags/number-system.md)&nbsp;`1` [operator-precedence](wiki/tags/operator-precedence.md)&nbsp;`1` [ordered-list](wiki/tags/ordered-list.md)&nbsp;`1` [palindrome](wiki/tags/palindrome.md)&nbsp;`1` [parallel](wiki/tags/parallel.md)&nbsp;`1` [parser](wiki/tags/parser.md)&nbsp;`1` [parsing](wiki/tags/parsing.md)&nbsp;`1` [partitioning](wiki/tags/partitioning.md)&nbsp;`1` [path-finding](wiki/tags/path-finding.md)&nbsp;`1` [performance](wiki/tags/performance.md)&nbsp;`1` [physics](wiki/tags/physics.md)&nbsp;`1` [polygon](wiki/tags/polygon.md)&nbsp;`1` [power-set](wiki/tags/power-set.md)&nbsp;`1` [quadratic-interpolation](wiki/tags/quadratic-interpolation.md)&nbsp;`1` [quadratic-time](wiki/tags/quadratic-time.md)&nbsp;`1` [ranges](wiki/tags/ranges.md)&nbsp;`1` [refactor](wiki/tags/refactor.md)&nbsp;`1` [safe-dial](wiki/tags/safe-dial.md)&nbsp;`1` [search](wiki/tags/search.md)&nbsp;`1` [sieve](wiki/tags/sieve.md)&nbsp;`1` [spiral](wiki/tags/spiral.md)&nbsp;`1` [strategy](wiki/tags/strategy.md)&nbsp;`1` [string-manipulation](wiki/tags/string-manipulation.md)&nbsp;`1` [string-result](wiki/tags/string-result.md)&nbsp;`1` [subsequence-optimization](wiki/tags/subsequence-optimization.md)&nbsp;`1` [surface](wiki/tags/surface.md)&nbsp;`1` [tetris](wiki/tags/tetris.md)&nbsp;`1` [tree](wiki/tags/tree.md)&nbsp;`1` [trigonometry](wiki/tags/trigonometry.md)&nbsp;`1` [tsp](wiki/tags/tsp.md)&nbsp;`1` [unfold](wiki/tags/unfold.md)&nbsp;`1` [union-find](wiki/tags/union-find.md)&nbsp;`1` [walk3d](wiki/tags/walk3d.md)&nbsp;`1` [word-search](wiki/tags/word-search.md)&nbsp;`1` [zipper](wiki/tags/zipper.md)&nbsp;`1`
7681
<!-- STATS_END -->
7782

78-

lib/mix/tasks/readme.ex

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
defmodule Mix.Tasks.Readme do
2+
@moduledoc """
3+
Regenerates README.md from priv/partials/readme_content.md and updates stats.
4+
"""
5+
use Mix.Task
6+
7+
@impl Mix.Task
8+
def run(_args) do
9+
Mix.shell().info("Regenerating README.md from partials...")
10+
File.cp!("priv/partials/readme_content.md", "README.md")
11+
12+
Mix.shell().info("Updating stats in README.md...")
13+
System.cmd("python3", ["scripts/gen_wiki.py"])
14+
15+
Mix.shell().info("README.md has been rewritten and stats updated.")
16+
end
17+
end

0 commit comments

Comments
 (0)