TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
microscenarioproviderrandom.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 "microscenarioprovider.h"
11 
12 namespace cherrypi {
13 
14 /**
15  * Generates Random armies. Parameters:
16  * AllowedRaces: the set of races we can randomly draw from
17  * maxSupplyMap: Maximum supply for each race.
18  * randomSize: if true, the target supply is drawn uniformly in [min(10,
19  * maxSupply), maxSupply]. Else, the target supply is the one
20  * from the supplyMap.
21  * checkCompatiblity: if true, we don't sample armies that are incompatible.
22  * Sources of incompatiblilites: air units in one army but no air weapon in
23  * the other, ground units in one army but no ground weapon in the other,
24  * cloaked/burrowable units in one army but no detector in the other.
25  * In other words, we require that each unit can be attacked by at least one
26  * unit of the other army.
27  *
28  * Note that due to sampling artifacts, the actual sampled supply
29  * might be a bit smaller than the target
30  *
31  * The default parameters give scenarios that are somewhat balanced (as
32  * mesured by playing random battles using attack-closest heuristic and no
33  * micro). Protoss has a slightly lower win-rate on average, around 30%.
34  *
35  * The following units are currently left out:
36  * - All spell caster (except Science Vessels, which are used as detectors for
37  * terrans)
38  * - Reavers (no way to spawn scarabs currently)
39  * - Carrier (same with interceptors)
40  * - Dropships
41  * - SCVs, Drones, Probes
42  * - Scourge + infested terrans (annoying micro)
43  */
45  public:
47  std::vector<tc::BW::Race> allowedRaces = {tc::BW::Race::Protoss,
48  tc::BW::Race::Terran,
49  tc::BW::Race::Zerg},
50  bool randomSize = true,
51  std::map<tc::BW::Race, int> maxSupplyMap = {{tc::BW::Race::Protoss, 60},
52  {tc::BW::Race::Terran, 55},
53  {tc::BW::Race::Zerg, 50}},
54  bool checkCompatibility = true);
55 
56  void setParams(
57  std::vector<tc::BW::Race> allowedRaces,
58  bool randomSize,
59  std::map<tc::BW::Race, int> maxSupplyMap,
60  bool checkCompatibility);
61 
62  protected:
64  std::vector<tc::BW::Race> allowedRaces_;
66  std::map<tc::BW::Race, int> maxSupplyMap_;
68 };
69 
70 } // namespace cherrypi
std::vector< tc::BW::Race > allowedRaces_
Definition: microscenarioproviderrandom.h:64
bool randomSize_
Definition: microscenarioproviderrandom.h:65
bool checkCompatibility_
Definition: microscenarioproviderrandom.h:67
void setParams(std::vector< tc::BW::Race > allowedRaces, bool randomSize, std::map< tc::BW::Race, int > maxSupplyMap, bool checkCompatibility)
Definition: microscenarioproviderrandom.cpp:265
FixedScenario getFixedScenario() override
Definition: microscenarioproviderrandom.cpp:276
std::map< tc::BW::Race, int > maxSupplyMap_
Definition: microscenarioproviderrandom.h:66
Definition: microscenarioprovider.h:18
Generates Random armies.
Definition: microscenarioproviderrandom.h:44
Definition: scenariospecification.h:57
MicroScenarioProviderRandom(std::vector< tc::BW::Race > allowedRaces={tc::BW::Race::Protoss, tc::BW::Race::Terran, tc::BW::Race::Zerg}, bool randomSize=true, std::map< tc::BW::Race, int > maxSupplyMap={{tc::BW::Race::Protoss, 60},{tc::BW::Race::Terran, 55},{tc::BW::Race::Zerg, 50}}, bool checkCompatibility=true)
Definition: microscenarioproviderrandom.cpp:254
Main namespace for bot-related code.
Definition: areainfo.cpp:17