TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
cherrypi::Tracker Class Referenceabstract

Abstract base class for Trackers. More...

#include <tracker.h>

Inherited by cherrypi::AttackTracker, cherrypi::BuildTracker, cherrypi::MovementTracker, cherrypi::ResearchTracker, and cherrypi::UpgradeTracker.

Public Member Functions

 Tracker (int timeout)
 
virtual ~Tracker ()
 
TrackerStatus status () const
 
void cancel ()
 
bool failed () const
 
bool succeeded () const
 
virtual bool update (State *s)
 Updates the tracker. More...
 

Protected Member Functions

virtual bool updateNotTracking (State *s)=0
 Updates the tracker if its status is NotTracking. More...
 
virtual bool updatePending (State *s)=0
 Updates the tracker if its status is Pending. More...
 
virtual bool updateOngoing (State *s)=0
 Updates the tracker if its status is Ongoing. More...
 

Protected Attributes

TrackerStatus status_ = TrackerStatus::NotTracking
 
int time_ = 0
 
int timeout_
 

Detailed Description

Abstract base class for Trackers.

A tracker monitors the execution of a given target. For example, this could be the command issued in the game (via CommandTracker) or the implementation of an UPCSTuple (via TaskTracker). At any given time, the tracker will provide a status assumption regarding the target. It will end up in either Timeout, Success or Failure. See TrackerStatus for a description of the individual modes.

Tracker implementations provide update functions for the NotTracking, Pending and Ongoing status. Timeouts are handled by the base class.

Constructor & Destructor Documentation

cherrypi::Tracker::Tracker ( int  timeout)
inline
virtual cherrypi::Tracker::~Tracker ( )
inlinevirtual

Member Function Documentation

void cherrypi::Tracker::cancel ( )
inline
bool cherrypi::Tracker::failed ( ) const
inline
TrackerStatus cherrypi::Tracker::status ( ) const
inline
bool cherrypi::Tracker::succeeded ( ) const
inline
bool cherrypi::Tracker::update ( State s)
virtual

Updates the tracker.

Returns true if status has changed

virtual bool cherrypi::Tracker::updateNotTracking ( State s)
protectedpure virtual

Updates the tracker if its status is NotTracking.

Returns true if status has changed

Implemented in cherrypi::AttackTracker, cherrypi::ResearchTracker, cherrypi::UpgradeTracker, cherrypi::BuildTracker, and cherrypi::MovementTracker.

virtual bool cherrypi::Tracker::updateOngoing ( State s)
protectedpure virtual

Updates the tracker if its status is Ongoing.

Returns true if status has changed

Implemented in cherrypi::AttackTracker, cherrypi::ResearchTracker, cherrypi::UpgradeTracker, cherrypi::BuildTracker, and cherrypi::MovementTracker.

virtual bool cherrypi::Tracker::updatePending ( State s)
protectedpure virtual

Updates the tracker if its status is Pending.

Returns true if status has changed

Implemented in cherrypi::AttackTracker, cherrypi::ResearchTracker, cherrypi::UpgradeTracker, cherrypi::BuildTracker, and cherrypi::MovementTracker.

Member Data Documentation

TrackerStatus cherrypi::Tracker::status_ = TrackerStatus::NotTracking
protected
int cherrypi::Tracker::time_ = 0
protected
int cherrypi::Tracker::timeout_
protected

The documentation for this class was generated from the following files: