projects
/
advent-of-code-16.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a8f5015
)
Tidying
author
Neil Smith
<neil.git@njae.me.uk>
Tue, 13 Dec 2016 10:36:42 +0000
(10:36 +0000)
committer
Neil Smith
<neil.git@njae.me.uk>
Tue, 13 Dec 2016 10:36:42 +0000
(10:36 +0000)
advent13.hs
patch
|
blob
|
history
diff --git
a/advent13.hs
b/advent13.hs
index a6e56d90e69e7dc66026580bdf6b0c587cf7d4e9..94669fd3b7ea54ac6e81f031cc2d2c853163f77b 100644
(file)
--- a/
advent13.hs
+++ b/
advent13.hs
@@
-1,10
+1,6
@@
import Data.List ((\\), nub, sortOn)
import Data.List ((\\), nub, sortOn)
-import Numeric (showIntAtBase)
-import Data.Char (intToDigit)
import Data.Bits (popCount)
import Data.Bits (popCount)
-import qualified Data.Map.Lazy as Map -- day 4, 5
-
type Pos = (Int, Int)
seed = 1362
type Pos = (Int, Int)
seed = 1362
@@
-23,7
+19,6
@@
part1 = print $ length $ tail $ extractJust $ aStar [[(1, 1)]] []
part2 :: IO ()
part2 = do print $ length $ tail $ edl 50 [[(1, 1)]] []
putStrLn $ showRoomR 30 25 $ edl 50 [[(1, 1)]] []
part2 :: IO ()
part2 = do print $ length $ tail $ edl 50 [[(1, 1)]] []
putStrLn $ showRoomR 30 25 $ edl 50 [[(1, 1)]] []
--- part2 = print $ length $ tail $ edl 50 [[(1, 1)]] []
extractJust :: Maybe [a] -> [a]
extractJust :: Maybe [a] -> [a]
@@
-36,11
+31,7
@@
isWall x y = (popCount n) `mod` 2 == 1
n = x*x + 3*x + 2*x*y + y + y*y + seed
n = x*x + 3*x + 2*x*y + y + y*y + seed
-showRoom w h = unlines rows
- where
- rows = [row x | x <- [0..h]]
- row x = [showCell x y | y <- [0..w]]
- showCell x y = if (isWall x y) then '#' else '.'
+showRoom w h = showRoomR w h []
showRoomR w h reached = unlines rows
where
showRoomR w h reached = unlines rows
where