C++ Joueur Client
 All Classes Namespaces Functions Variables
game.hpp
1 #ifndef GAMES_PIRATES_GAME_H
2 #define GAMES_PIRATES_GAME_H
3 
4 // Game
5 // Steal from merchants and become the most infamous pirate.
6 
7 // DO NOT MODIFY THIS FILE
8 // Never try to directly create an instance of this class, or modify its member variables.
9 // Instead, you should only be reading its variables and calling its functions.
10 
11 #include <vector>
12 #include <queue>
13 #include <deque>
14 #include <unordered_map>
15 #include <string>
16 #include <initializer_list>
17 
18 #include "../../joueur/src/any.hpp"
19 
20 
21 #include "../../joueur/src/base_game.hpp"
22 #include "impl/pirates_fwd.hpp"
23 
24 // <<-- Creer-Merge: includes -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs.
25 // you can add additional #includes here
26 // <<-- /Creer-Merge: includes -->>
27 
28 namespace cpp_client
29 {
30 
39 namespace pirates
40 {
41 
45 class Game : public Base_game
46 {
47 public:
48 
52  const double& bury_interest_rate;
53 
57  const int& crew_cost;
58 
62  const int& crew_damage;
63 
67  const int& crew_health;
68 
72  const int& crew_moves;
73 
77  const double& crew_range;
78 
83 
87  const int& current_turn;
88 
92  const std::unordered_map<std::string, Game_object>& game_objects;
93 
97  const double& heal_factor;
98 
102  const int& map_height;
103 
107  const int& map_width;
108 
112  const int& max_turns;
113 
117  const double& merchant_gold_rate;
118 
122  const double& merchant_interest_rate;
123 
127  const double& min_interest_distance;
128 
132  const std::vector<Player>& players;
133 
137  const std::vector<Port>& ports;
138 
142  const double& rest_range;
143 
147  const std::string& session;
148 
152  const int& ship_cost;
153 
157  const int& ship_damage;
158 
162  const int& ship_health;
163 
167  const int& ship_moves;
168 
172  const double& ship_range;
173 
177  const std::vector<Tile>& tiles;
178 
183 
187  const std::vector<Unit>& units;
188 
189  // <<-- Creer-Merge: member variables -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs.
190  // You can add additional member variables here. None of them will be tracked or updated by the server.
191  // <<-- /Creer-Merge: member variables -->>
192 
193 
200  Tile get_tile_at(const int x, const int y);
201 
202  // <<-- Creer-Merge: methods -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs.
203  // You can add additional methods here.
204  // <<-- /Creer-Merge: methods -->>
205 
206  ~Game_();
207 
208  // ####################
209  // Don't edit these!
210  // ####################
212  Game_(std::initializer_list<std::pair<std::string, Any&&>> init);
213  Game_() : Game_({}){}
214  virtual void resize(const std::string& name, std::size_t size) override;
215  virtual void change_vec_values(const std::string& name, std::vector<std::pair<std::size_t, Any>>& values) override;
216  virtual void remove_key(const std::string& name, Any& key) override;
217  virtual std::unique_ptr<Any> add_key_value(const std::string& name, Any& key, Any& value) override;
218  virtual bool is_map(const std::string& name) override;
219  virtual void rebind_by_name(Any* to_change, const std::string& member, std::shared_ptr<Base_object> ref) override;
221  // ####################
222  // Don't edit these!
223  // ####################
224 };
225 
226 } // pirates
227 
228 } // cpp_client
229 
230 #endif // GAMES_PIRATES_GAME_H
const int & ship_cost
How much gold it costs to construct a ship.
Definition: game.hpp:152
const std::vector< Port > & ports
Every Port in the game. Merchant ports have owner set to null.
Definition: game.hpp:137
const double & heal_factor
How much health a Unit recovers when they rest.
Definition: game.hpp:97
const int & map_height
The number of Tiles in the map along the y (vertical) axis.
Definition: game.hpp:102
const int & max_turns
The maximum number of turns before the game will automatically end.
Definition: game.hpp:112
const int & ship_health
The maximum amount of health a ship can have.
Definition: game.hpp:162
const std::vector< Player > & players
List of all the players in the game.
Definition: game.hpp:132
const double & rest_range
How far a Unit can be from a Port to rest. Range is circular.
Definition: game.hpp:142
A Tile in the game that makes up the 2D map grid.
Definition: tile.hpp:37
const std::string & session
A unique identifier for the game instance that is being played.
Definition: game.hpp:147
const int & ship_damage
How much damage ships deal to ships and ports.
Definition: game.hpp:157
const double & merchant_gold_rate
How much gold merchant Ports get each turn.
Definition: game.hpp:117
const std::unordered_map< std::string, Game_object > & game_objects
A mapping of every game object's ID to the actual game object. Primarily used by the server and clien...
Definition: game.hpp:92
const int & crew_cost
How much gold it costs to construct a single crew.
Definition: game.hpp:57
const std::vector< Tile > & tiles
All the tiles in the map, stored in Row-major order. Use x + y * mapWidth to access the correct index...
Definition: game.hpp:177
const Player & current_player
The player whose turn it is currently. That player can send commands. Other players cannot...
Definition: game.hpp:82
const int & map_width
The number of Tiles in the map along the x (horizontal) axis.
Definition: game.hpp:107
const double & ship_range
A ship's attack range. Range is circular.
Definition: game.hpp:172
Steal from merchants and become the most infamous pirate.
Definition: game.hpp:45
const int & current_turn
The current turn number, starting at 0 for the first player's turn.
Definition: game.hpp:87
const double & merchant_interest_rate
When a merchant ship spawns, the amount of additional gold it has relative to the Port's investment...
Definition: game.hpp:122
const int & time_added_per_turn
The amount of time (in nano-seconds) added after each player performs a turn.
Definition: game.hpp:182
const double & crew_range
A crew's attack range. Range is circular.
Definition: game.hpp:77
const int & crew_damage
How much damage crew deal to each other.
Definition: game.hpp:62
const int & ship_moves
The number of moves Units with ships are given each turn.
Definition: game.hpp:167
const int & crew_health
The maximum amount of health a crew member can have.
Definition: game.hpp:67
const double & min_interest_distance
The Euclidean distance buried gold must be from the Player's Port to accumulate interest.
Definition: game.hpp:127
const double & bury_interest_rate
The rate buried gold increases each turn.
Definition: game.hpp:52
Tile get_tile_at(const int x, const int y)
Gets the Tile at a specified (x, y) position
const std::vector< Unit > & units
Every Unit in the game. Merchant units have targetPort set to a port.
Definition: game.hpp:187
const int & crew_moves
The number of moves Units with only crew are given each turn.
Definition: game.hpp:72
A player in this game. Every AI controls one player.
Definition: player.hpp:37