Day18: Backup2
This commit is contained in:
parent
4c55fd04e8
commit
a5cda9b104
7
day15.hs
7
day15.hs
|
@ -14,13 +14,6 @@ main = do
|
||||||
let winRobot = (map(\(Robot br pts pos dir) -> Robot br [] pos 1) winRobots) !! 0
|
let winRobot = (map(\(Robot br pts pos dir) -> Robot br [] pos 1) winRobots) !! 0
|
||||||
let part2Robots = (runRobot winRobot)
|
let part2Robots = (runRobot winRobot)
|
||||||
let part2Length = map(\(Robot br pts pos dir) -> length (filter(\(p,c) -> c == 1)pts))part2Robots
|
let part2Length = map(\(Robot br pts pos dir) -> length (filter(\(p,c) -> c == 1)pts))part2Robots
|
||||||
let endPoints = foldl (++) [] (map(\(Robot br pts pos dir) -> pts) resultRobots)
|
|
||||||
let yMin = List.minimum (map(\((x,y),c) -> y) endPoints)
|
|
||||||
let yMax = List.maximum (map(\((x,y),c) -> y) endPoints)
|
|
||||||
let posEndPoints = map(\((a,b),c)-> ((a+30,b),c)) endPoints
|
|
||||||
let ship = createMap posEndPoints (reverse [yMin-1..yMax]) []
|
|
||||||
mapM putStrLn(map show ship)
|
|
||||||
putStrLn(show $ length endPoints)
|
|
||||||
putStrLn(show winRobotsLength)
|
putStrLn(show winRobotsLength)
|
||||||
putStrLn(show $ List.maximum( part2Length))
|
putStrLn(show $ List.maximum( part2Length))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue