diff options
-rw-r--r-- | 6-2.hs | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -50,9 +50,10 @@ checkAhead :: Map -> Vel -> Coords -> Bool checkAhead m = (((== Free) . sub m) .) . move turn :: Vel -> Coords -> (Coords, Vel) -turn v p = let rot (Coords x y) = Coords (-y) x - v' = rot v - in (move v' p, v') +turn v p = + let rot (Coords x y) = Coords (-y) x + v' = rot v + in (p, v') step :: Map -> Vel -> Coords -> (Coords, Vel) step m v p = if checkAhead m v p @@ -103,6 +104,4 @@ main = do let path = map fst $ execState (run m v p) [] let ms = possibilities m $ nub path let res = ms `pseq` (map (\ n -> evalState (run n v p) []) ms `using` parList rdeepseq) --- putStr . unlines . intersperse "--" . map (showMap . fst) . filter snd . zip ms $ res print . length . filter id $ res --- print . length $ ms |