From: Neil Smith Date: Thu, 12 Dec 2019 08:28:38 +0000 (+0000) Subject: Now using Double, not Float X-Git-Url: https://git.njae.me.uk/?p=advent-of-code-19.git;a=commitdiff_plain;h=80ff586cedab2e26c2375413041496dec82bdece Now using Double, not Float --- diff --git a/advent10/src/advent10.hs b/advent10/src/advent10.hs index ba90ba1..376f667 100644 --- a/advent10/src/advent10.hs +++ b/advent10/src/advent10.hs @@ -12,7 +12,7 @@ type Position = V2 Rational type Asteroids = S.Set Position -type TargetInfo = (Float, Float) +type TargetInfo = (Double, Double) type Targets = M.Map TargetInfo Position main :: IO () @@ -76,7 +76,7 @@ targetInfo origin target = (angle, range) targetSequence :: Targets -> [Position] targetSequence targets = targetNext ((- pi / 2) - 0.001) targets -targetNext :: Float -> Targets -> [Position] +targetNext :: Double -> Targets -> [Position] targetNext angle targets | M.null targets = [] | M.null possibles = targetNext (- pi) targets @@ -86,7 +86,7 @@ targetNext angle targets targets' = M.delete (targetAngle, targetRange) targets angle' = targetAngle -possibleTargets :: Float -> Targets -> Targets +possibleTargets :: Double -> Targets -> Targets possibleTargets angle targets = M.filterWithKey (\(a, _) _ -> a > angle) targets firstTarget :: Targets -> (TargetInfo, Position)