Run this notebook

Use Livebook to open this notebook and explore new ideas.

It is easy to get started, on your machine or the cloud.

Click below to open and run it in your Livebook at .

(or change your Livebook location)

# AOC 2022 - Day 12 ```elixir Mix.install([ {:kino_aoc, "~> 0.1"} ]) ``` ## AOC Helper <!-- livebook:{"attrs":{"assign_to":"puzzle_input","day":"12","session_secret":"AOC_SESSION","year":"2022"},"chunks":null,"kind":"Elixir.KinoAOC.HelperCell","livebook_object":"smart_cell"} --> ```elixir {:ok, puzzle_input} = KinoAOC.download_puzzle("2022", "12", System.fetch_env!("LB_AOC_SESSION")) ``` <!-- livebook:{"branch_parent_index":0} --> ## Part 1 ## Code ```elixir defmodule PartOne do def solve(input) do IO.puts("--- Part One ---") IO.puts("Result: #{run(input)}") end def run(input) do end end ``` ## Test ```elixir ExUnit.start(autorun: false) defmodule PartOneTest do use ExUnit.Case, async: true import PartOne @input "" @expected nil test "part one" do actual = run(@input) assert actual == @expected end end ExUnit.run() ``` ## Solution ```elixir PartOne.solve(puzzle_input) ``` <!-- livebook:{"branch_parent_index":4} --> ## Part 2 ## Code ```elixir defmodule PartTwo do def solve(input) do IO.puts("--- Part Two ---") IO.puts("Result: #{run(input)}") end def run(input) do end end ``` ## Test ```elixir ExUnit.start(autorun: false) defmodule PartTwoTest do use ExUnit.Case, async: true import PartTwo @input "" @expected nil test "part two" do actual = run(@input) assert actual == @expected end end ExUnit.run() ``` ## Solution ```elixir PartTwo.solve(puzzle_input) ``` <!-- livebook:{"offset":1483,"stamp":{"token":"XCP.YiNweQA41LRdjh3keJTAugSvHTv_LyDV27dquA4-t7jN5IdTLMahE455xl2AvXDEoKR_7rnAr-UxO5BUXa-UQgSaGI-Bv1pXIKa56aT72_HiJuSnlq8","version":2}} -->
See source

Have you already installed Livebook?

If you already installed Livebook, you can configure the default Livebook location where you want to open notebooks.
Livebook up Checking status We can't reach this Livebook (but we saved your preference anyway)
Run notebook

Not yet? Install Livebook in just a minute

Livebook is open source, free, and ready to run anywhere.

Run on your machine

with Livebook Desktop

Run in the cloud

on select platforms

To run on Linux, Docker, embedded devices, or Elixir’s Mix, check our README.

PLATINUM SPONSORS
SPONSORS
Code navigation with go to definition of modules and functions Read More ×