TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
|
Class holding a playedGames vector for a given enemy. More...
#include <bandit.h>
Public Member Functions | |
EnemyHistory (std::string enemyName, std::string readFolder="bwapi-data/read/", std::string writeFolder="bwapi-data/write/") | |
void | addStartingGame (std::string buildOrder) |
Records a failed game for the given build order, which will be updated on game end with the actual win status. More... | |
void | updateLastGameToVictory (std::string buildOrder) |
In case of won games, this modifies the last history into a won game (while it was set to loss as default) Updates the opponent file. More... | |
void | write () const |
Writes the current win history for all builds into the opponnent file. More... | |
void | printStatus () const |
Prints all strategies and their counts (for debugging) More... | |
std::string | readFilepath () const |
Path to the file where the history is recorded Defaults to returning writeFilepath if readFilepath does not exist. More... | |
std::string | writeFilepath () const |
Path to the file where the history is recorded (used as default if readFilepath() does not exists) More... | |
Public Attributes | |
std::unordered_map< std::string, BuildOrderCount > | buildOrderCounts |
map from build order to its counts (number of played games, won games etc...) More... | |
Friends | |
class | cereal::access |
Class holding a playedGames vector for a given enemy.
History is loaded at instanciation from either read folder (in priority) or write folder, or a new empty history is created. An updated version is saved when calling either "addPlayedGame", "write" or "updateLastGameToVictory" methods. Beware: it does not check that the file was updated after it was loaded (i.e. at instance creation).
cherrypi::model::EnemyHistory::EnemyHistory | ( | std::string | enemyName, |
std::string | readFolder = "bwapi-data/read/" , |
||
std::string | writeFolder = "bwapi-data/write/" |
||
) |
void cherrypi::model::EnemyHistory::addStartingGame | ( | std::string | buildOrder | ) |
Records a failed game for the given build order, which will be updated on game end with the actual win status.
This is done so that in case of crash, the game is accounted for as a crash. Updates the opponent file.
void cherrypi::model::EnemyHistory::printStatus | ( | ) | const |
Prints all strategies and their counts (for debugging)
|
inline |
Path to the file where the history is recorded Defaults to returning writeFilepath if readFilepath does not exist.
void cherrypi::model::EnemyHistory::updateLastGameToVictory | ( | std::string | buildOrder | ) |
In case of won games, this modifies the last history into a won game (while it was set to loss as default) Updates the opponent file.
void cherrypi::model::EnemyHistory::write | ( | ) | const |
Writes the current win history for all builds into the opponnent file.
|
inline |
Path to the file where the history is recorded (used as default if readFilepath() does not exists)
|
friend |
std::unordered_map<std::string, BuildOrderCount> cherrypi::model::EnemyHistory::buildOrderCounts |
map from build order to its counts (number of played games, won games etc...)