From bdc807471407c23e8c4b47518de01daeb3b312c3 Mon Sep 17 00:00:00 2001 From: Karl Ostmo Date: Mon, 18 Sep 2023 22:26:34 -0700 Subject: [PATCH] review feedback: turn manhattan distance into Integer --- src/Swarm/Game/Step.hs | 2 +- src/Swarm/Game/Step/Pathfinding.hs | 4 ++-- src/Swarm/Language/Syntax.hs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Swarm/Game/Step.hs b/src/Swarm/Game/Step.hs index 9a81cd306..dc1db3dbc 100644 --- a/src/Swarm/Game/Step.hs +++ b/src/Swarm/Game/Step.hs @@ -1046,7 +1046,7 @@ execConst c vs s k = do maybeLimit <- if hasLimit then case limitVal of - VInt d -> return $ Just $ fromIntegral d + VInt d -> return $ Just d _ -> badConst else return Nothing goal <- diff --git a/src/Swarm/Game/Step/Pathfinding.hs b/src/Swarm/Game/Step/Pathfinding.hs index 9c4f0f602..15f02f0ce 100644 --- a/src/Swarm/Game/Step/Pathfinding.hs +++ b/src/Swarm/Game/Step/Pathfinding.hs @@ -59,7 +59,7 @@ data PathfindingTarget pathCommand :: (HasRobotStepState sig m, Has (State GameState) sig m) => -- | Distance limit - Maybe Int32 -> + Maybe Integer -> -- | Starting location Cosmic Location -> -- | Search goal @@ -87,7 +87,7 @@ pathCommand maybeLimit (Cosmic currentSubworld robotLoc) target = do (return robotLoc) withinDistanceLimit :: Location -> Bool - withinDistanceLimit = (<= distanceLimit) . manhattan robotLoc + withinDistanceLimit = (<= distanceLimit) . fromIntegral . manhattan robotLoc -- Extracts the head of the found path to determine -- the next direction for the robot to proceed along diff --git a/src/Swarm/Language/Syntax.hs b/src/Swarm/Language/Syntax.hs index 8e7a1497b..970d37567 100644 --- a/src/Swarm/Language/Syntax.hs +++ b/src/Swarm/Language/Syntax.hs @@ -119,7 +119,7 @@ maxScoutRange = 64 maxStrideRange :: Int maxStrideRange = 64 -maxPathRange :: Int32 +maxPathRange :: Integer maxPathRange = 128 ------------------------------------------------------------