Powered by AppSignal & Oban Pro
Would you like to see your link here? Contact us

AoC 2023 Day 3

2023/day3.livemd

AoC 2023 Day 3

Mix.install([
  {:kino_aoc, "~> 0.1.5"}
])

Input

{:ok, puzzle_input} =
  KinoAOC.download_puzzle("2023", "3", System.fetch_env!("LB_AOC_COOKIE_SECRET"))

Parsing

puzzle_input =
  """
  467..114..
  ...*......
  ..35..633.
  ......#...
  617*......
  .....+.58.
  ..592.....
  ......755.
  ...$.*....
  .664.598..
  """
  |> String.trim()
def parse_lookahead(x, acc) do
end
lines = String.split(puzzle_input, "\n")

column_count = lines |> List.first() |> String.length()
line_count = Enum.count(lines)

grid =
  lines
  |> Enum.map(&String.codepoints/1)

for y <- 0..(line_count - 1), x <- 0..(column_count - 1), reduce: %{} do
  acc ->
    char =
      grid
      |> Enum.at(y)
      |> Enum.at(x)

    # case char do
    #   c when c in ?0..?9 -> 
    # end
end
Integer.parse("foo123")

Part 1

puzzle_input

Part 2