part1, part2 :: Track -> TrackCost -> TrackCost -> Int
part1 = bigSavings 2 100
part2 = bigSavings 20 100
--- where fullCost = costsFromStart M.! track.goal
--- cheatCosts = allCheatedCosts 2 track costsFromStart costsFromGoal
--- savings = filter (>= 100) $ fmap (\c -> fullCost - c) cheatCosts
--- part2 track costsFromStart costsFromGoal = length savings
--- where fullCost = costsFromStart M.! track.goal
--- cheatCosts = allCheatedCosts 20 track costsFromStart costsFromGoal
--- savings = filter (>= 100) $ fmap (\c -> fullCost - c) cheatCosts
bigSavings :: Int -> Int -> Track -> TrackCost -> TrackCost -> Int
bigSavings cheatLen savingThreshold track costsFromStart costsFromGoal = length savings
start = head [ V2 r c | r <- [0..rMax], c <- [0..cMax], rows !! r !! c == 'S' ]
goal = head [ V2 r c | r <- [0..rMax], c <- [0..cMax], rows !! r !! c == 'E' ]
-
showTrackWithCheat :: Track -> Position -> String
showTrackWithCheat track here = unlines $ fmap showRow [0..rMax]
where rMax = maximum $ fmap (\(V2 r _) -> r) $ S.toList $ walls track