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

Provides scenarios constructed from Snapshots of real games. More...

#include <microscenarioprovidersnapshot.h>

Inherits cherrypi::MicroScenarioProvider.

Public Member Functions

MicroScenarioProviderSnapshot & setSnapshotDirectory (const std::string &)
 Specifies the directory where snapshots are located. More...
 
MicroScenarioProviderSnapshot & setIndexFile (const std::string &)
 Specifies a file lists snapshots relative to the SnapshotDirectory. More...
 
FixedScenario getFixedScenario () override
 Samples a Scenario from the list specified in setIndexFile. More...
 
- Public Member Functions inherited from cherrypi::MicroScenarioProvider
virtual ~MicroScenarioProvider ()=default
 
void setReplay (std::string const &path)
 
std::pair< std::shared_ptr< BasePlayer >, std::shared_ptr< BasePlayer > > startNewScenario (const std::function< void(BasePlayer *)> &setup1, const std::function< void(BasePlayer *)> &setup2) override
 Spawns a scenario. More...
 
void endScenario ()
 
std::unique_ptr< Reward > getReward () const
 
void setMapPathPrefix (const std::string &)
 It's possible to run this from not the rootdir of the repository, in which case you can set the mapPathPrefix to where the maps should be found. More...
 
- Public Member Functions inherited from cherrypi::ScenarioProvider
virtual ~ScenarioProvider ()=default
 
ScenarioProvider & setMaxFrames (int value)
 The maximum number of steps to play before considering a scenario finished Defaults to -1, which indicates no maximum. More...
 
ScenarioProvider & setGui (bool value)
 Specifies whether to run OpenBW headfully. More...
 
virtual bool isFinished (int currentStep)
 Check whether the scenario is finished. More...
 

Protected Member Functions

void invalidate_ ()
 
Snapshot loadSnapshot_ ()
 
- Protected Member Functions inherited from cherrypi::MicroScenarioProvider
void endGame ()
 
void killAllUnits ()
 
void createNewGame ()
 
void createNewPlayers ()
 
void setupScenario ()
 
bool launchedWithReplay ()
 
MicroPlayer & microPlayer1 ()
 
MicroPlayer & microPlayer2 ()
 
- Protected Member Functions inherited from cherrypi::ScenarioProvider
template<typename TPlayer >
void loadMap (std::string const &map, tc::BW::Race race1, tc::BW::Race race2, GameType gameType, std::string const &replayPath=std::string())
 

Protected Attributes

std::string snapshotDirectory_
 
std::string indexFile_
 
std::unique_ptr< common::DataReader< Snapshot > > dataReader_
 
std::unique_ptr< common::DataReaderIterator< Snapshot > > dataIterator_
 
- Protected Attributes inherited from cherrypi::MicroScenarioProvider
std::shared_ptr< tc::Client > client1_
 
std::shared_ptr< tc::Client > client2_
 
std::string replay_
 
std::string mapPathPrefix_
 
FixedScenario scenarioNow_
 
int unitsThisGame_ = 0
 
int unitsTotal_ = 0
 
int unitsSeenTotal_ = 0
 
int scenarioCount_ = 0
 
int resetCount_ = 0
 
- Protected Attributes inherited from cherrypi::ScenarioProvider
int maxFrame_ = 24 * 60 * 60 * 2
 
bool gui_ = false
 
std::shared_ptr< BasePlayer > player1_
 
std::shared_ptr< BasePlayer > player2_
 
std::shared_ptr< GameMultiPlayer > game_
 

Detailed Description

Provides scenarios constructed from Snapshots of real games.

Member Function Documentation

FixedScenario cherrypi::MicroScenarioProviderSnapshot::getFixedScenario ( )
overridevirtual

Samples a Scenario from the list specified in setIndexFile.

Implements cherrypi::MicroScenarioProvider.

void cherrypi::MicroScenarioProviderSnapshot::invalidate_ ( )
protected
Snapshot cherrypi::MicroScenarioProviderSnapshot::loadSnapshot_ ( )
protected
MicroScenarioProviderSnapshot & cherrypi::MicroScenarioProviderSnapshot::setIndexFile ( const std::string &  file)

Specifies a file lists snapshots relative to the SnapshotDirectory.

MicroScenarioProviderSnapshot & cherrypi::MicroScenarioProviderSnapshot::setSnapshotDirectory ( const std::string &  directory)

Specifies the directory where snapshots are located.

Member Data Documentation

std::unique_ptr<common::DataReaderIterator<Snapshot> > cherrypi::MicroScenarioProviderSnapshot::dataIterator_
protected
std::unique_ptr<common::DataReader<Snapshot> > cherrypi::MicroScenarioProviderSnapshot::dataReader_
protected
std::string cherrypi::MicroScenarioProviderSnapshot::indexFile_
protected
std::string cherrypi::MicroScenarioProviderSnapshot::snapshotDirectory_
protected

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