Skip to content

Attempt at starting advent of code using advent-of-code-elixir-starter as a starter. It's tempting to port in behavior from https://github.com/staylorwr/elixir_aoc

Notifications You must be signed in to change notification settings

w0rd-driven/advent-of-code-elixir

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Advent of Code Elixir Starter

A batteries included starter pack for participating in Advent of Code using Elixir!

Usage

There are 25 modules, 25 tests, and 50 mix tasks.

The modules are responsible for the implementation using inputs. The tests are responsible for verifying the test cases in the puzzle text are checked. The mix tasks are responsible for producing the complete output and benchmarking the results.

  1. Fill in the tests with the example solution(s) for part 1.
    1. Note: We explicitly make assertions match the test cases given in the puzzle text.
  2. Write your implementation.
  3. Make sure your test passes by running mix test.
  4. Fill in the final problem inputs into the mix task and run mix d01.p1!
    • Benchmark your solution by passing the -b flag, mix d01.p1 -b
  5. Input the puzzle answer to unlock part 2. Repeat for each day that has multiple parts.
defmodule AdventOfCode.Day01 do
  def part1(args) do
  end

  def part2(args) do
  end
end
defmodule AdventOfCode.Day01Test do
  use ExUnit.Case

  import AdventOfCode.Day01

  @tag :skip # Make sure to remove to run your test.
  test "part1" do
    input = nil
    result = part1(input)

    assert result
  end

  @tag :skip # Make sure to remove to run your test.
  test "part2" do
    input = nil
    result = part2(input)

    assert result
  end
end
defmodule Mix.Tasks.D01.P1 do
  use Mix.Task

  import AdventOfCode.Day01

  @shortdoc "Day 01 Part 1"
  def run(args) do
    input = nil

    if Enum.member?(args, "-b"),
      do: Benchee.run(%{part_1: fn -> input |> part1() end}),
      else:
        input
        |> part1()
        |> IO.inspect(label: "Part 1 Results")
  end
end

Installation

Repository Template

  1. Click Use this template.
  2. Fill in Repository name.
  3. Fill in Description (optional).
  4. Choose Public or Private access.
  5. Uncheck include all branches as we only care for main.

Manual

# clone
$ git clone git@github.com:mhanberg/advent-of-code-elixir-starter.git advent-of-code
$ cd advent-of-code

# Reinitialize your git repo
$ rm -rf .git
$ git init

Puzzles

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

Journal

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

About

Attempt at starting advent of code using advent-of-code-elixir-starter as a starter. It's tempting to port in behavior from https://github.com/staylorwr/elixir_aoc

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages