Skip to content
Template project for Advent of Code in Elixir.
Elixir
Branch: master
Clone or download
mhanberg Remove reference to year
The year is not necessary.
Latest commit 2beebe5 Nov 28, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config Remove reference to year Dec 2, 2019
lib Remove reference to year Dec 2, 2019
test Remove reference to year Dec 2, 2019
.formatter.exs Initial Commit Nov 29, 2018
.gitignore
.tool-versions
README.md Remove reference to year Dec 2, 2019
mix.exs Add benchmarking Nov 29, 2019

README.md

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.

  1. Fill in the tests with the example solutions.
  2. Write your implementation.
  3. 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
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

# 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
You can’t perform that action at this time.