TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
fogofwar.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 <array>
11 #include <cstddef>
12 #include <vector>
13 
14 namespace cherrypi {
15 
16 class TilesInfo;
17 
18 /**
19  * Calculates which tiles should be revealed by a unit's vision.
20  * BWAPI gives you your own vision, but this can be used to understand
21  * the opponent's vision.
22  */
23 class FogOfWar {
24  struct sight_values_t {
25  struct maskdat_node_t {
26  size_t prev;
27  size_t prev2;
29  int x;
30  int y;
31  };
32  int max_width, max_height;
33  int min_width, min_height;
34  int min_mask_size;
35  int ext_masked_count;
36  std::vector<maskdat_node_t> maskdat;
37  };
38 
39  std::array<sight_values_t, 12> sight_values;
40 
41  void generateSightValues();
42 
43  public:
44  FogOfWar();
45  void revealSightAt(
46  TilesInfo& tt,
47  int x,
48  int y,
49  int range,
50  bool in_air,
51  int currentFrame) const;
52 };
53 } // namespace cherrypi
FogOfWar()
Definition: fogofwar.cpp:15
Calculates which tiles should be revealed by a unit&#39;s vision.
Definition: fogofwar.h:23
Manages and updates per-tile data.
Definition: tilesinfo.h:81
void revealSightAt(TilesInfo &tt, int x, int y, int range, bool in_air, int currentFrame) const
Definition: fogofwar.cpp:19
Main namespace for bot-related code.
Definition: areainfo.cpp:17
int relative_tile_index
Definition: fogofwar.h:28