From 225ff905424bd176a3e971801a2215e61761833d Mon Sep 17 00:00:00 2001 From: Neil Smith Date: Wed, 18 Dec 2024 17:36:32 +0000 Subject: [PATCH] Bug fix --- advent18/MainExplorer.hs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/advent18/MainExplorer.hs b/advent18/MainExplorer.hs index 8d63149..da58a95 100644 --- a/advent18/MainExplorer.hs +++ b/advent18/MainExplorer.hs @@ -29,15 +29,13 @@ data Explorer = Explorer , ct :: Int } -- deriving (Eq, Ord, Show) - deriving (Eq, Show) + deriving (Show) + +instance Eq Explorer where + e1 == e2 = pos e1 == pos e2 + instance Ord Explorer where compare e1 e2 = compare (pos e1) (pos e2) - -- compare e1 e2 = case pc of - -- EQ -> compare (ct e1) (ct e2) - -- _ -> pc - -- where pc = compare (pos e1) (pos e2) - --- type Explorer = Position memoryBounds :: (Position, Position) -- memoryBounds = (V2 0 0, V2 6 6) @@ -101,7 +99,6 @@ estimateCost memory e = (abs dx) + (abs dy) where (V2 dx dy) = e.pos ^-^ memory.goal initial :: Memory -> Explorer --- initial memory = Explorer { pos = memory.start } initial memory = Explorer { pos = memory.start, ct = 0 } -- parse the input file -- 2.34.1