| License | BSD-3-Clause |
|---|---|
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Swarm.Game.Step.Path.Cache.DistanceLimit
Description
Handles cache invalidation if the distance
limit is modified between invocations of
the Path command.
Synopsis
- getDistanceLimitInvalidation :: Location -> NonEmpty Location -> Maybe Integer -> Maybe Integer -> Either DistanceLimitChange ()
- withinDistance :: Integer -> Location -> Location -> Bool
Documentation
getDistanceLimitInvalidation Source #
Arguments
| :: Location | current robot location |
| -> NonEmpty Location | original path |
| -> Maybe Integer | current limit |
| -> Maybe Integer | previous limit |
| -> Either DistanceLimitChange () |
A greater distance limit might yield a shorter path if there was a better route that just needed to venture outside of the allowed radius.
On the other hand, a smaller distance limit will not invalidate the cache so long as all cells on the path are within the new limit.
This function is shared between path computation logic
and patch cache invalidation logic to ensure that
the choice of inequality operator is consistent (e.g. < vs. <=).