Tweaked syntax layout in successors
authorNeil Smith <neil.git@njae.me.uk>
Sat, 6 Oct 2018 22:30:56 +0000 (23:30 +0100)
committerNeil Smith <neil.git@njae.me.uk>
Sat, 6 Oct 2018 22:30:56 +0000 (23:30 +0100)
src/task8/task8-bounded.hs
src/task8/task8.hs

index d9767860a3fdb806d89d39a1d30d287a92e6920c..9bef74e9dd6bd3975c5038c679521ec33b303c90 100644 (file)
@@ -98,13 +98,14 @@ successors :: Int -> BoundedLawn -> Location -> (Q.Seq Neighbour)
 successors longCost boundedLawn (row, column) = Q.fromList $ map neighbourify neighbours
     where lawn = lawnMap boundedLawn
           neighbours = filter (\l -> l `M.member` lawn) 
-                                [(r, c) | r <- [(row - 1)..(row + 1)], 
-                                          c <- [(column - 1)..(column + 1)],
-                                          r >= minR,
-                                          r <= maxR,
-                                          c >= minC,
-                                          c <= maxC,
-                                          ((r == row && c /= column) || (r /= row && c == column)) ]
+                                [ (r, c) | r <- [(row - 1)..(row + 1)]
+                                         , c <- [(column - 1)..(column + 1)]
+                                         , r >= minR
+                                         , r <= maxR
+                                         , c >= minC
+                                         , c <= maxC
+                                         , ((r == row && c /= column) || (r /= row && c == column))
+                                ]
           neighbourify neighbour = Neighbour {stepLocation = neighbour, stepCost = scCalc neighbour}
           minR = minRow boundedLawn
           maxR = maxRow boundedLawn
index b23198dd285124d004be999fba22fa2eb709830b..83e7e3bd35d7a3288f8fbedbf3b62114cc1364ef 100644 (file)
@@ -82,13 +82,14 @@ candidates longCost lawn agendum closed = newCandidates
 successors :: Int -> Lawn -> Location -> (Q.Seq Neighbour)
 successors longCost lawn (row, column) = Q.fromList $ map neighbourify neighbours
     where neighbours = filter (\l -> l `M.member` lawn) 
-                                [(r, c) | r <- [(row - 1)..(row + 1)], 
-                                          c <- [(column - 1)..(column + 1)],
-                                          r >= minR,
-                                          r <= maxR,
-                                          c >= minC,
-                                          c <= maxC,
-                                          ((r == row && c /= column) || (r /= row && c == column)) ]
+                                [ (r, c) | r <- [(row - 1)..(row + 1)]
+                                         , c <- [(column - 1)..(column + 1)]
+                                         , r >= minR
+                                         , r <= maxR
+                                         , c >= minC
+                                         , c <= maxC
+                                         , ((r == row && c /= column) || (r /= row && c == column))
+                                ]
           neighbourify neighbour = Neighbour {stepLocation = neighbour, stepCost = scCalc neighbour}
           minR = minimum $ map fst $ M.keys lawn
           maxR = maximum $ map fst $ M.keys lawn