Skip to content

Commit

Permalink
Add pocketwatch
Browse files Browse the repository at this point in the history
  • Loading branch information
Janiczek committed Dec 19, 2024
1 parent 179717a commit 80b7637
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/aoc_2024/day_19.gleam
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import gleam/bool
import gleam/int
import gleam/io
import gleam/list
import gleam/string
import pocket_watch
import rememo/memo

pub type Input {
Input(towels: List(String), patterns: List(String))
}

pub fn parse(input: String) -> Input {
use <- pocket_watch.simple("parse")
case string.split(input, "\n\n") {
[towels_str, patterns_str] -> {
Input(
Expand All @@ -22,6 +23,7 @@ pub fn parse(input: String) -> Input {
}

pub fn pt_1(input: Input) {
use <- pocket_watch.simple("part 1")
input.patterns
|> list.count(pt_1_possible(input.towels, _))
}
Expand Down Expand Up @@ -51,6 +53,7 @@ fn pt_1_possible_aux(towels: List(String), todos: List(String)) -> Bool {
}

pub fn pt_2(input: Input) {
use <- pocket_watch.simple("part 2")
use cache <- memo.create()
input.patterns
|> list.map(pt_2_all(input.towels, _, cache))
Expand Down

0 comments on commit 80b7637

Please sign in to comment.