projects
/
advent-of-code-16.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
More tidying
[advent-of-code-16.git]
/
advent11.hs
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