TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
microplayer.h
1 /*
2  * Copyright (c) 2017-present, Facebook, Inc.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #pragma once
9 
10 #include "baseplayer.h"
11 
12 namespace cherrypi {
13 
14 /**
15  * The main bot object for training scenarios.
16  *
17  * This class is used to play StarCraft Broodwar (TM) via the TorchCraft bridge.
18  * The behavior and actions of the player are determined by a user-supplied list
19  * of bot modules.
20  *
21  * In contrast to Player, this class does not provide convenience methods for
22  * initializing a game and running it until the end -- it's assumed that users
23  * of this class handle this. Instead, onGameStart() and onGameEnd() are
24  * exposed, which call the respective functions of all bot modules that have
25  * been added to the player. The rationale for this is to enable repeated
26  * usage or instantiation of MicroPlayers during a single TorchCraft session.
27  */
28 class MicroPlayer : public BasePlayer {
29  using ClientCommands = std::vector<tc::Client::Command>;
30 
31  public:
32  MicroPlayer(std::shared_ptr<tc::Client> client);
33  MicroPlayer(const MicroPlayer&) = delete;
34  MicroPlayer& operator=(const MicroPlayer&) = delete;
35 
36  void onGameStart();
37  void onGameEnd();
38 
39  protected:
40  bool gameStarted_ = false;
41 };
42 
43 } // namespace cherrypi
MicroPlayer(std::shared_ptr< tc::Client > client)
Definition: microplayer.cpp:14
void onGameStart()
Definition: microplayer.cpp:17
bool gameStarted_
Definition: microplayer.h:40
The main bot object.
Definition: baseplayer.h:28
MicroPlayer & operator=(const MicroPlayer &)=delete
void onGameEnd()
Definition: microplayer.cpp:27
Main namespace for bot-related code.
Definition: areainfo.cpp:17
The main bot object for training scenarios.
Definition: microplayer.h:28