Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kostmo committed Mar 11, 2024
1 parent e49d29c commit 80d5b76
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/swarm-engine/Swarm/Game/State/Robot.hs
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,6 @@ activateRobot rid = internalActiveRobots %= IS.insert rid
-- from the 'waitingRobots' queue and put them back in the 'activeRobots' set
-- if they still exist in the keys of 'robotMap'.
--
-- Returns the set of robots that were awakened at THIS TICK.
--
-- = Mutations
--
-- This function modifies:
Expand All @@ -314,13 +312,13 @@ activateRobot rid = internalActiveRobots %= IS.insert rid
-- * 'internalActiveRobots' (aka 'activeRobots')
wakeUpRobotsDoneSleeping :: (Has (State Robots) sig m) => TickNumber -> m ()
wakeUpRobotsDoneSleeping time = do
maybeWakeableRIDs <- internalWaitingRobots . at time <<.= Nothing
case maybeWakeableRIDs of
mrids <- internalWaitingRobots . at time <<.= Nothing
case mrids of
Nothing -> return ()
Just wakeableRIDs -> do
Just rids -> do
robots <- use robotMap
let robotIdSet = IM.keysSet robots
wakeableRIDsSet = IS.fromList wakeableRIDs
wakeableRIDsSet = IS.fromList rids

-- Limit ourselves to the robots that have not expired in their sleep
newlyAlive = IS.intersection robotIdSet wakeableRIDsSet
Expand Down

0 comments on commit 80d5b76

Please sign in to comment.