projects
/
advent-of-code-20.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6bf86d6
)
Tidying
author
Neil Smith
<neil.git@njae.me.uk>
Fri, 1 Jan 2021 12:17:40 +0000
(12:17 +0000)
committer
Neil Smith
<neil.git@njae.me.uk>
Fri, 1 Jan 2021 12:17:40 +0000
(12:17 +0000)
advent20/src/advent20.hs
patch
|
blob
|
history
diff --git
a/advent20/src/advent20.hs
b/advent20/src/advent20.hs
index 01d997d4e1f2e963cdf566f5886e807dece02f71..92138c45cc30f62d2804293df563f78de7bbb6d8 100644
(file)
--- a/
advent20/src/advent20.hs
+++ b/
advent20/src/advent20.hs
@@
-15,7
+15,6
@@
import qualified Data.Map.Strict as M
import Data.Bool (bool)
import Data.List (delete)
import Control.Monad (guard, foldM)
import Data.Bool (bool)
import Data.List (delete)
import Control.Monad (guard, foldM)
--- import Data.Either (fromRight)
type Coord = (Int, Int)
type Coord = (Int, Int)
@@
-69,7
+68,6
@@
arrangeTiles :: Int -> [Tile] -> Arrangement
arrangeTiles rMax tiles = fst $ head $ foldM arrange (M.empty, tiles) locations
where locations = init $ scanl nextLoc (0, 0) tiles
nextLoc (r, c) _ = if c == rMax then (r + 1, 0) else (r, c + 1)
arrangeTiles rMax tiles = fst $ head $ foldM arrange (M.empty, tiles) locations
where locations = init $ scanl nextLoc (0, 0) tiles
nextLoc (r, c) _ = if c == rMax then (r + 1, 0) else (r, c + 1)
- -- (arrangement, _) = head $ foldM arrange (M.empty, tiles) locations
arrange :: (Arrangement, [Tile]) -> Coord -> [(Arrangement, [Tile])]
arrange (grid, tiles) (r, c) =
arrange :: (Arrangement, [Tile]) -> Coord -> [(Arrangement, [Tile])]
arrange (grid, tiles) (r, c) =