Skip to content

Commit

Permalink
review feedback: turn manhattan distance into Integer
Browse files Browse the repository at this point in the history
  • Loading branch information
kostmo committed Sep 19, 2023
1 parent a0c061d commit bdc8074
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Swarm/Game/Step.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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 <-
Expand Down
4 changes: 2 additions & 2 deletions src/Swarm/Game/Step/Pathfinding.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Swarm/Language/Syntax.hs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ maxScoutRange = 64
maxStrideRange :: Int
maxStrideRange = 64

maxPathRange :: Int32
maxPathRange :: Integer
maxPathRange = 128

------------------------------------------------------------
Expand Down

0 comments on commit bdc8074

Please sign in to comment.