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

Commit

Permalink
start conversion to state
Browse files Browse the repository at this point in the history
  • Loading branch information
mstksg committed Dec 19, 2023
1 parent 6740a01 commit 6aabdf5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/AOC/Challenge/Day18.hs
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,15 @@ day18a :: _ :~> _
day18a = MkSol
{ sParse = traverse parseLineA . lines
, sShow = show
, sSolve = fmap shoelace . NE.nonEmpty . scanl' go 0
, sSolve = NE.nonEmpty . flip evalState (0, Nothing) . traverse (uncurry go)
-- , sSolve = fmap shoelace . NE.nonEmpty . scanl' go 0
}
where
go p (d, i) = p + i *^ dirPoint' d
go :: Dir -> Int -> State (Point, Maybe Dir) [Point]
go d i = state \(p, lastDir) ->
let p' = p + i *^ dirPoint' d
in undefined
-- go p (d, i) = p + i *^ dirPoint' d

parseLineB :: String -> Maybe (Dir, Int)
parseLineB = splitUp . filter isHexDigit <=< (!? 2) . words
Expand Down

0 comments on commit 6aabdf5

Please sign in to comment.