Skip to content

Commit

Permalink
Minor formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
code-shoily committed Aug 17, 2024
1 parent 487e0a6 commit a328abb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions lib/2015/day_04.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ defmodule AdventOfCode.Y2015.Day04 do
Difficulty: s
Tags: md5 annoying
"""
def run, do: {run_1(), run_2()}
def run_1, do: lowest_number("bgvyzdsv", 1)
def run_2, do: "bgvyzdsv" |> lowest_number_2(1)

Expand Down
10 changes: 7 additions & 3 deletions lib/2015/day_06.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,19 @@ defmodule AdventOfCode.Y2015.Day06 do
def input, do: InputReader.read_from_file(2015, 6)

def run(input \\ input()) do
input = Enum.map(Transformers.lines(input), &parse_input/1)
parsed_input = parse(input)
grid = make_grid(1000)

task_1 = Task.async(fn -> brightness(Enum.reduce(input, grid, &apply_1/2)) end)
task_2 = Task.async(fn -> brightness(Enum.reduce(input, grid, &apply_2/2)) end)
task_1 = Task.async(fn -> brightness(Enum.reduce(parsed_input, grid, &apply_1/2)) end)
task_2 = Task.async(fn -> brightness(Enum.reduce(parsed_input, grid, &apply_2/2)) end)

{Task.await(task_1, :infinity), Task.await(task_2, :infinity)}
end

def parse(input \\ input()) do
Enum.map(Transformers.lines(input), &parse_input/1)
end

def apply_1(line, grid),
do: apply(line, grid, fn _ -> 1 end, fn _ -> 0 end, fn v -> (v == 0 && 1) || 0 end)

Expand Down
1 change: 0 additions & 1 deletion lib/advent_of_code.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ defmodule AdventOfCode do
@moduledoc """
Module that solves problem given year and day.
"""

@latest_year 2023

@type year() :: 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023
Expand Down

0 comments on commit a328abb

Please sign in to comment.