Day 18: remove comments & cruft
This commit is contained in:
parent
725fd929be
commit
02bfd4d708
|
@ -60,58 +60,3 @@ distanceFromTo dmap schar echar =
|
||||||
|
|
||||||
findPos :: Char -> DungeonMap -> V2 Int
|
findPos :: Char -> DungeonMap -> V2 Int
|
||||||
findPos c = head . M.keys . M.filter (`elem` [c])
|
findPos c = head . M.keys . M.filter (`elem` [c])
|
||||||
|
|
||||||
-- countBlocks :: ScreenBuffer -> String
|
|
||||||
-- countBlocks = show . length . M.filter (== 2)
|
|
||||||
-- getIntersections :: ScreenBuffer -> ScreenBuffer
|
|
||||||
-- getIntersections buf = M.filterWithKey f buf
|
|
||||||
-- where
|
|
||||||
-- f k v = v == 35 && and [buf M.!? (k + u) == Just 35 | u <- unitVecs]
|
|
||||||
--
|
|
||||||
-- getTurns :: ScreenBuffer -> ScreenBuffer
|
|
||||||
-- getTurns buf = M.filterWithKey f buf M.\\ getIntersections buf
|
|
||||||
-- where
|
|
||||||
-- f k v =
|
|
||||||
-- v == 35 &&
|
|
||||||
-- or
|
|
||||||
-- [ buf M.!? (k + u) == Just 35 && buf M.!? (k + perp u) == Just 35
|
|
||||||
-- | u <- unitVecs
|
|
||||||
-- ]
|
|
||||||
-- countIntAlign :: ScreenBuffer -> String
|
|
||||||
-- countIntAlign m = show $ sum [x * y | (V2 x y, _) <- M.toList m]
|
|
||||||
toRelPath :: [V2 Int] -> [V2 Int]
|
|
||||||
toRelPath path = zipWith (-) (tail path) path
|
|
||||||
|
|
||||||
toCMD :: V2 Int -> [V2 Int] -> [String]
|
|
||||||
toCMD _ [] = []
|
|
||||||
toCMD u (x:xs)
|
|
||||||
| crossZ u x < 0 = ("R" ++ (show . abs . sum) x) : toCMD (perp u) xs
|
|
||||||
| crossZ u x >= 0 = ("L" ++ (show . abs . sum) x) : toCMD (perp (u * (-1))) xs
|
|
||||||
|
|
||||||
-- getCMD :: ScreenBuffer -> [String]
|
|
||||||
-- getCMD buf = toCMD dir (toRelPath path)
|
|
||||||
-- where
|
|
||||||
-- (pos, dir) = roboPos buf
|
|
||||||
-- path = pos : getPath buf [] [pos]
|
|
||||||
-- getPath :: ScreenBuffer -> [V2 Int] -> [V2 Int] -> [V2 Int]
|
|
||||||
-- getPath _ acc [] = acc
|
|
||||||
-- getPath m acc currs =
|
|
||||||
-- let a = nextTurn \\ acc
|
|
||||||
-- in getPath m (acc ++ a) a
|
|
||||||
-- where
|
|
||||||
-- curr = head currs
|
|
||||||
-- candidates =
|
|
||||||
-- M.filterWithKey
|
|
||||||
-- (\k _ -> v2x (k - curr) == 0 || v2y (k - curr) == 0)
|
|
||||||
-- (getTurns m)
|
|
||||||
-- isConnected =
|
|
||||||
-- M.filterWithKey
|
|
||||||
-- (\k _ ->
|
|
||||||
-- and
|
|
||||||
-- [ m M.!? x `elem` [Just 35, Just 94]
|
|
||||||
-- | x <- map (+ curr) $ drawLine (k - curr)
|
|
||||||
-- ])
|
|
||||||
-- nextTurn =
|
|
||||||
-- map fst $
|
|
||||||
-- M.toList $ M.filterWithKey (\k _ -> M.member k m) $ isConnected candidates
|
|
||||||
--nur keys^ im lambda
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user