swarm-0.7.0.0: 2D resource gathering game with programmable robots
LicenseBSD-3-Clause
Safe HaskellNone
LanguageHaskell2010

Swarm.Game.Robot.Concrete

Description

Support for instantiated robots.

Synopsis

Lenses

activityCounts :: Lens' Robot ActivityCounts Source #

Diagnostic and operational tracking of CESK steps or other activity

robotLog :: Lens' Robot (Seq LogEntry) Source #

The robot's own private message log, most recent message last. Messages can be added both by explicit use of the Log command, and by uncaught exceptions. Stored as a Seq so that we can efficiently add to the end and also process from beginning to end. Note that updating via this lens will also set the robotLogUpdated.

robotLogUpdated :: Lens' Robot Bool Source #

Has the robotLog been updated since the last time it was viewed?

Query

waitingUntil :: Robot -> Maybe TickNumber Source #

The time until which the robot is waiting, if any.

getResult :: Robot -> Maybe Value Source #

Get the result of the robot's computation if it is finished.

isActive :: Robot -> Bool Source #

Is the robot actively in the middle of a computation?

wantsToStep :: TickNumber -> Robot -> Bool Source #

Active robots include robots that are waiting; wantsToStep is true if the robot actually wants to take another step right now (this is a subset of active robots).

Utilities

instantiateRobot :: Maybe CESK -> RID -> TRobot -> Robot Source #

Instantiate a robot template to make it into a concrete robot, by providing a robot ID. Concrete robots also require a location; if the robot template didn't have a location already, just set the location to (0,0) by default. If you want a different location, set it via trobotLocation before calling instantiateRobot.

If a machine is not supplied (i.e. Nothing), will fallback to any program specified in the template robot.

Orphan instances

ToJSON Robot Source # 
Instance details

ToSample Robot Source # 
Instance details

Methods

toSamples :: Proxy Robot -> [(Text, Robot)] #