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:
ec008e1
)
More tidying
author
Neil Smith
<neil.git@njae.me.uk>
Mon, 12 Dec 2016 12:44:04 +0000
(12:44 +0000)
committer
Neil Smith
<neil.git@njae.me.uk>
Mon, 12 Dec 2016 12:44:04 +0000
(12:44 +0000)
advent11.hs
patch
|
blob
|
history
diff --git
a/advent11.hs
b/advent11.hs
index af048de2f7090c05d09ebd1a68b9a058eb386396..58215fd6da22ec671ee05f3b22d21d66ea734ca3 100644
(file)
--- a/
advent11.hs
+++ b/
advent11.hs
@@
-110,10
+110,8
@@
legalSuccessors :: [Building] -> [Building]
legalSuccessors = filter (isLegal)
updateBuilding :: Int -> [Floor] -> Int -> [Item] -> Building
legalSuccessors = filter (isLegal)
updateBuilding :: Int -> [Floor] -> Int -> [Item] -> Building
--- updateBuilding f floors _ _ = Building f floors
updateBuilding oldF oldFloors newF items = Building newF newFloors
updateBuilding oldF oldFloors newF items = Building newF newFloors
- where numberedFloors = zip [0..] oldFloors
- newFloors = map (updateFloor) numberedFloors
+ where newFloors = map (updateFloor) $ zip [0..] oldFloors
updateFloor (f, fl)
| f == oldF = sort $ fl \\ items
| f == newF = sort $ items ++ fl
updateFloor (f, fl)
| f == oldF = sort $ fl \\ items
| f == newF = sort $ items ++ fl