Browse Source

Day18: Backup2

master
Arranun 2 years ago
parent
commit
a5cda9b104
  1. 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 part2Robots = (runRobot winRobot)
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 $ List.maximum( part2Length))

Loading…
Cancel
Save