Skip to content
This repository has been archived by the owner on Nov 17, 2024. It is now read-only.

Commit

Permalink
holy poop this search space is huge
Browse files Browse the repository at this point in the history
  • Loading branch information
mstksg committed Dec 27, 2023
1 parent b39c661 commit ca4fd14
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/AOC/Challenge/Day23.hs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,25 @@ day23b =
sShow = show,
sSolve =
noFail $
maximum . map hs2Length . S.toList . paths2 . pathGraph . M.keysSet
searchSpace . pathGraph . M.keysSet
-- maximum . map hs2Length . S.toList . paths2 . pathGraph . M.keysSet
-- reduceGraph . pathGraph . M.keysSet
-- maximum . map (subtract 1 . S.size . hsSeen) . paths' . fmap (const Nothing)
}

searchSpace :: Map Point (NEMap Point Int) -> Int
searchSpace mp = S.size $ floodFill expander (S.singleton (HS S.empty (V2 1 0)))
where
expander HS{..} = S.fromList do
neighb <- S.toList $ NES.toSet (NEM.keysSet $ mp M.! hsCurr) `S.difference` hsSeen
pure $ HS seen' neighb
where
seen' = S.insert hsCurr hsSeen


-- floodFill
-- :: Ord a
-- => (a -> Set a) -- ^ Expansion (be sure to limit allowed points)
-- -> Set a -- ^ Start points
-- -> Set a -- ^ Flood filled
-- floodFill f = snd . floodFillCount f

0 comments on commit ca4fd14

Please sign in to comment.