Skip to content

Commit a7674bf

Browse files
committed
Update windows CRLF
1 parent 7549bdb commit a7674bf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+799
-705
lines changed

lib/2015/day_07/day_07.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ defmodule AdventOfCode.Y2015.Day07 do
33
--- Day 7: Some Assembly Required ---
44
Problem Link: https://adventofcode.com/2015/day/7
55
"""
6-
alias AdventOfCode.Helpers.InputReader
6+
alias AdventOfCode.Helpers.{InputReader, Transformers}
77
alias AdventOfCode.Y2015.Day07.ControlPanel
88

99
def input, do: InputReader.read_from_file(2015, 7)
@@ -34,7 +34,7 @@ defmodule AdventOfCode.Y2015.Day07 do
3434

3535
def parse(data \\ input()) do
3636
data
37-
|> String.split("\n", trim: true)
37+
|> Transformers.lines()
3838
|> Enum.map(&tokenize/1)
3939
|> Map.new(fn {instruction, wire} ->
4040
{wire, %{relation: instruction, providers: get_providers(instruction)}}

lib/2015/day_19.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ defmodule AdventOfCode.Y2015.Day19 do
22
@moduledoc """
33
--- Day 19: Medicine for Rudolph ---
44
Problem Link: https://adventofcode.com/2015/day/19
5-
5+
66
Helpful Tips for Part II: (,) analogy
77
https://www.reddit.com/r/adventofcode/comments/3xflz8/day_19_solutions/cy4etju
88
"""

lib/2015/day_21.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ defmodule AdventOfCode.Y2015.Day21 do
1313
Warhammer 25 6 0
1414
Longsword 40 7 0
1515
Greataxe 74 8 0
16-
16+
1717
Armor: Cost Damage Armor
1818
Leather 13 0 1
1919
Chainmail 31 0 2
2020
Splintmail 53 0 3
2121
Bandedmail 75 0 4
2222
Platemail 102 0 5
23-
23+
2424
Rings: Cost Damage Armor
2525
Damage +1 25 1 0
2626
Damage +2 50 2 0
@@ -85,7 +85,7 @@ defmodule AdventOfCode.Y2015.Day21 do
8585

8686
def store do
8787
@item_db
88-
|> String.split("\n\n", trim: true)
88+
|> String.split(~r{(\r\n\r\n|\r\r|\n\n)}, trim: true)
8989
|> Enum.map(&Transformers.lines/1)
9090
|> Map.new(fn [title | data] ->
9191
{

lib/2016/day_02.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ defmodule AdventOfCode.Y2016.Day02 do
33
--- Day 2: Bathroom Security ---
44
Problem Link: https://adventofcode.com/2016/day/2
55
"""
6-
alias AdventOfCode.Helpers.InputReader
6+
alias AdventOfCode.Helpers.{InputReader, Transformers}
77

88
def input, do: InputReader.read_from_file(2016, 2)
99
@initial_position_1 5
@@ -38,7 +38,7 @@ defmodule AdventOfCode.Y2016.Day02 do
3838

3939
defp parse(input) do
4040
input
41-
|> String.split("\n")
41+
|> Transformers.lines()
4242
|> Enum.map(&String.graphemes/1)
4343
end
4444

lib/2016/day_06.ex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ defmodule AdventOfCode.Y2016.Day06 do
33
--- Day 6: Signals and Noise ---
44
Problem Link: https://adventofcode.com/2016/day/6
55
"""
6-
alias AdventOfCode.Helpers.InputReader
6+
alias AdventOfCode.Helpers.{InputReader, Transformers}
77

88
def input, do: InputReader.read_from_file(2016, 6)
99

@@ -16,10 +16,11 @@ defmodule AdventOfCode.Y2016.Day06 do
1616
def do_run(input, type), do: Enum.map_join(input, &frequency(&1, type))
1717

1818
def parse(input) do
19-
len = String.split(input, "\n", trim: true) |> hd() |> String.length()
19+
len = input |> Transformers.lines() |> hd() |> String.length()
2020

2121
input
2222
|> String.replace("\n", "")
23+
|> String.replace("\r", "")
2324
|> String.codepoints()
2425
|> Enum.with_index()
2526
|> Enum.map(fn {k, idx} -> {k, rem(idx, len)} end)

lib/2017/day_10.ex

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,21 @@ defmodule AdventOfCode.Y2017.Day10 do
2020

2121
@doc """
2222
Computes knot hash for given `key_string`
23-
23+
2424
## Example
25-
25+
2626
iex> Solution.compute_knot_hash("")
2727
"a2582a3a0e66e6e86e3812dcb672a272"
28-
28+
2929
iex> Solution.compute_knot_hash("AoC 2017")
3030
"33efeb34ea91902bb2f59c9920caa6cd"
31-
31+
3232
iex> Solution.compute_knot_hash("1,2,3")
3333
"3efbe78a8d82f29979031a4aa0b16a9d"
34-
34+
3535
iex> Solution.compute_knot_hash("1,2,4")
3636
"63960835bcdc130f0b66d7ff4f6a5a8e"
37-
37+
3838
"""
3939
def compute_knot_hash(key_string) do
4040
{bytes, list_map} = parse_bytes(key_string)

lib/2017/day_14.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ defmodule AdventOfCode.Y2017.Day14 do
22
@moduledoc """
33
--- Day 14: Disk Defragmentation ---
44
Problem Link: https://adventofcode.com/2017/day/14
5-
5+
66
TODO: Look into strongly connected components to get the regions.
77
"""
88
alias AdventOfCode.Helpers.{InputReader, Transformers}

lib/2018/day_05.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ defmodule AdventOfCode.Y2018.Day05 do
22
@moduledoc """
33
--- Day 5: Alchemical Reduction ---
44
Problem Link: https://adventofcode.com/2018/day/5
5-
5+
66
Thanks to `BenAlbin/Adent-Of-Code-2018` for the fastest solution, and helping me
77
learn interesting way of solving the problem.
88
"""

lib/2019/day_01.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ defmodule AdventOfCode.Y2019.Day01 do
33
--- Day 1: The Tyranny of the Rocket Equation ---
44
Problem Link: https://adventofcode.com/2019/day/1
55
"""
6-
alias AdventOfCode.Helpers.InputReader
6+
alias AdventOfCode.Helpers.{InputReader, Transformers}
77

88
def input, do: InputReader.read_from_file(2019, 1)
99

@@ -29,7 +29,7 @@ defmodule AdventOfCode.Y2019.Day01 do
2929

3030
def parse(data) do
3131
data
32-
|> String.split("\n")
32+
|> Transformers.lines()
3333
|> Enum.map(&String.to_integer/1)
3434
end
3535

lib/2019/day_03.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ defmodule AdventOfCode.Y2019.Day03 do
33
--- Day 3: Crossed Wires ---
44
Problem Link: https://adventofcode.com/2019/day/3
55
"""
6-
alias AdventOfCode.Helpers.InputReader
6+
alias AdventOfCode.Helpers.{InputReader, Transformers}
77

88
@origin {0, 0}
99

@@ -42,7 +42,7 @@ defmodule AdventOfCode.Y2019.Day03 do
4242

4343
def parse(data) do
4444
data
45-
|> String.split("\n")
45+
|> Transformers.lines()
4646
|> Enum.map(fn line ->
4747
line
4848
|> String.split(",")

0 commit comments

Comments
 (0)