From c989c37a9282d8ef9a6f269a6c14997571abafec Mon Sep 17 00:00:00 2001 From: sabadev Date: Wed, 3 Feb 2021 19:48:43 -0500 Subject: [PATCH] Removed some redundancy from limitCoords --- src/Game.hs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/Game.hs b/src/Game.hs index a0726c7..670f992 100644 --- a/src/Game.hs +++ b/src/Game.hs @@ -199,15 +199,11 @@ moveCharacter (Just R) character = updatePosition (0, 1) character moveCharacter _ character = character limitCoords :: G.Coords -> G.Coords -limitCoords (a, b) = (limitRowCoord a, limitColumnCoord b) +limitCoords (a, b) = (limitCoord snd a, limitCoord fst b) where - limitRowCoord a - | a < snd topLeftBoundary = snd topLeftBoundary - | a > snd bottomRightBoundary = snd bottomRightBoundary - | otherwise = a - limitColumnCoord a - | a < fst topLeftBoundary = fst topLeftBoundary - | a > fst bottomRightBoundary = fst bottomRightBoundary + limitCoord projection a + | a < projection topLeftBoundary = projection topLeftBoundary + | a > projection bottomRightBoundary = projection bottomRightBoundary | otherwise = a updatePosition :: G.Coords -> Character t -> Character t -- 2.20.1