From 8d23ac258abab5768737183f4f2dbab5d28dc26b Mon Sep 17 00:00:00 2001 From: Gattix Date: Sat, 10 Dec 2022 05:59:41 +0100 Subject: [PATCH] day 9 part 2 --- 2022/day09/day09.hs | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/2022/day09/day09.hs b/2022/day09/day09.hs index dba51a3..e40e03b 100644 --- a/2022/day09/day09.hs +++ b/2022/day09/day09.hs @@ -1,7 +1,5 @@ import Linear.V2 import Data.List -import Data.List.Split -import Control.Lens type Rope = (V2 Int,V2 Int) @@ -39,15 +37,3 @@ tailMove (V2 a b) = V2 (f a) (f b) | abs a == abs b = if abs a == 2 then x `div` 2 else 0 | abs a + abs b == 1 = 0 | otherwise = if abs x == 2 then x `div` 2 else x - -p :: Int -> [Int] -> String -p n (x:xs) = if n == x then '#' : p (n+1) xs else '.' : p (n+1) (x:xs) -p _ [] = [] - -print2D :: Int -> [V2 Int] -> [String] -print2D n coords - | n == (pred minY) = [] - | otherwise = p minX line : print2D (n-1) coords - where line = sort $ map (^._x) (filter (\(V2 _ a) -> a == n) coords) - minY = minimum $ map (^._y) coords - minX = minimum $ map (^._x) coords