TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
scouting.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 "buildtype.h"
11 #include "module.h"
12 #include "task.h"
13 
14 namespace cherrypi {
15 
16 /**
17  * Scout management
18  */
19 enum class ScoutingGoal {
20  FindEnemyBase = 0,
24  Automatic // decide depending on context
25 };
26 
27 class ScoutingModule : public Module {
28  public:
29  virtual ~ScoutingModule() = default;
30 
31  virtual void step(State* s) override;
32 
33  // this should be accessible to the higher-level module
34  // or decided in context
35  void setScoutingGoal(ScoutingGoal);
36  ScoutingGoal goal(State* state) const; // used for automatic decisions
37 
38  protected:
39  Unit* findUnit(
40  State* state,
41  std::unordered_map<Unit*, float> const&,
42  Position const& pos);
43  bool postTask(
44  State* state,
45  UpcId baseUpcId,
46  Unit* unit,
47  Position loc,
48  ScoutingGoal goal);
49  bool postMoveUPC(
50  State* state,
51  UpcId baseUpcId,
52  Unit* unit,
53  const Position& loc,
54  bool useSafeMove = true);
55  Position nextScoutingLocation(
56  State* state,
57  Unit* unit,
58  std::unordered_map<Position, int> const&);
59  void updateLocations(
60  State* state,
61  std::unordered_map<Position, int>&,
62  std::vector<Position> const&);
63 
64  std::unordered_map<Position, int> startingLocations_;
66 };
67 
68 } // namespace cherrypi
std::unordered_map< Position, int > startingLocations_
Definition: scouting.h:64
Game state.
Definition: state.h:42
Represents a unit in the game.
Definition: unitsinfo.h:35
ScoutingGoal
Scout management.
Definition: scouting.h:19
Definition: scouting.h:27
Main namespace for bot-related code.
Definition: areainfo.cpp:17
int UpcId
Definition: basetypes.h:23
Interface for bot modules.
Definition: module.h:30