From bbf615a66d1814ff196313b206cd3bcc239079c1 Mon Sep 17 00:00:00 2001
From: Andreas Grois <andi@grois.info>
Date: Sun, 22 Dec 2024 23:23:13 +0100
Subject: Complete Day 17 Part 1

---
 Day17.lean | 12 ++++++++++++
 1 file changed, 12 insertions(+)

(limited to 'Day17.lean')

diff --git a/Day17.lean b/Day17.lean
index 4bddc1c..11a92f2 100644
--- a/Day17.lean
+++ b/Day17.lean
@@ -389,6 +389,18 @@ decreasing_by
     have : closedSet.size < (Finite.cardinality (ClosedSetEntry heatLossMap)) := Std.HashSet.size_lt_finite_cardinality_of_not_mem closedSet ⟨_,h₂⟩
     omega
 
+def part1 (heatLossMap : HeatLossMap) : Option Nat :=
+  heatLossMap.findPath (OpenSet.start heatLossMap) Std.HashSet.empty
+
+------------------------------------------------------------------------------------
+
+open DayPart
+instance : Parse ⟨17, by simp⟩ (ι := HeatLossMap) where
+  parse := (Except.mapError ToString.toString) ∘ parse
+
+instance : Part ⟨17,_⟩ Parts.One (ι := HeatLossMap) (ρ := Nat) where
+  run := part1
+
 ------------------------------------------------------------------------------------
 
 private def testData := "2413432311323
-- 
cgit v1.2.3

