Terminal Games
Simple games that run in the terminal.
Loading...
Searching...
No Matches
Battleships.cpp
1#include <array>
2#include <chrono>
3#include <cmath>
4#include <cstdint>
5#include <string>
6#include <thread>
7#include <tuple>
8#include <unordered_map>
9#include <utility>
10#include <vector>
11
12#include "helpers/GameInformation.hpp"
13#include "helpers/Globals.hpp"
14#include "helpers/PageBuilder.hpp"
15#include "helpers/Terminal.hpp"
16
17#include "games/Battleships.hpp"
18
19namespace TerminalGames
20{
21 Battleships::Battleships(const bool& p_useAnsiEscapeCodes) :
23 m_turnCount(0),
25 m_isGameOver(false),
27 {
28 m_pageBuilder.SetProperties(Pages::BATTLESHIPS, p_useAnsiEscapeCodes);
29 m_randomNumberGenerator.seed(std::chrono::system_clock::now().time_since_epoch().count());
30 }
31
59
85
87 {
88 m_gameInformation.m_battleshipsGameInformation = {
89 .m_boardPlayerOne = m_boardPlayerOne,
90 .m_boardPlayerTwo = m_boardPlayerTwo,
91 .m_shipsRemainingPlayerOne = m_shipsRemainingPlayerOne,
92 .m_shipsRemainingPlayerTwo = m_shipsRemainingPlayerTwo,
93 .m_computerSpeedName = m_computerSpeedName,
94 .m_currentPlayer = m_currentPlayer,
95 .m_playerCount = m_playerCount,
96 .m_turnCount = m_turnCount,
97 .m_isGameOver = m_isGameOver,
98 };
99 }
100
107
112
117
119 {
120 // This function is assumed to be only called during one player games where player one is the user and player two is the
121 // computer. Therefore, user commands will be executed against player two's board (m_boardPlayerTwo).
122
123 while (true)
124 {
125 const std::tuple<uint32_t, uint32_t> SELECTED_COMMAND = Terminal::GetUserCommandFromGameGrid(m_previousCommand, m_pageBuilder, m_gameInformation, true);
126
127 if (ValidateCommand(m_commandsRemainingPlayerOne, SELECTED_COMMAND))
128 {
130 m_previousCommand = SELECTED_COMMAND;
131 return;
132 }
133 }
134 }
135
152
154 {
155 Terminal::GetUserChoiceFromGameOverMenu(m_pageBuilder.GetGameOverPage(m_gameInformation), m_pageBuilder.GetQuitOptionSelectionPage());
156 }
157
159 {
160 m_saveGameOptions = true;
161 }
162
164 {
165 m_saveGameOptions = false;
166 m_hasSavedGameOptions = false;
167 }
168
170 {
172
173 const std::vector<std::string> MENUS = m_pageBuilder.GetPlayerCountOptionSelectionGamePages(m_gameInformation);
174 const std::vector<std::string> QUIT_MENUS = m_pageBuilder.GetQuitOptionSelectionPage();
176 }
177
179 {
181
182 const std::vector<std::string> MENUS = m_pageBuilder.GetComputerSpeedOptionSelectionGamePages(m_gameInformation);
183 const std::vector<std::string> QUIT_MENUS = m_pageBuilder.GetQuitOptionSelectionPage();
186 }
187
189 {
190 // This function is assumed to be only called during one player games where player one is the user and player two is the
191 // computer. Therefore, user commands will be executed against player ones's board (m_boardPlayerOne).
192
194
195 uint32_t startingRow = 0;
196 uint32_t startingColumn = 0;
197 uint32_t lastShipStartingRow = 0;
198 uint32_t lastShipStartingColumn = 0;
199 bool shipIsHorizontal = false;
200 bool shipIsVertical = false;
201
202 // For each ship
203 for (uint32_t currentShip = 0; currentShip < Globals::G_BATTLESHIPS_SHIP_COUNT; currentShip++)
204 {
205 std::vector<std::tuple<uint32_t, uint32_t>> currentShipPositions;
206
207 // For each ship grid location (intentionally a signed int)
208 for (int32_t currentShipSize = 0; std::cmp_less(currentShipSize, Globals::G_BATTLESHIPS_SHIP_SIZES.at(currentShip)); currentShipSize++)
209 {
210 // Set cursor position to the last known valid user selected ship grid location for the currentShip
211 if (!currentShipPositions.empty())
212 {
213 startingRow = std::get<0>(currentShipPositions.back());
214 startingColumn = std::get<1>(currentShipPositions.back());
215 }
216
217 else
218 {
219 // No valid user selected ship grid location available for currentShip. There are two reasons which cause
220 // this:
221 // 1. On the very first execution of this line of code as no ship grid locations have been selected.
222 // 2. When the user has undone all selected ship grid locations for the currentShip meaning there are no
223 // valid previous ship grid locations. Thus, get the last known ship grid locations for the previous
224 // currentShip. Also, since all ship grid locations for the currentShip have been undone we reset the
225 // shipIs... booleans.
226 startingRow = lastShipStartingRow;
227 startingColumn = lastShipStartingColumn;
228 shipIsHorizontal = false;
229 shipIsVertical = false;
230 }
231
232 while (true) // While ship grid location is incorrect
233 {
234 try
235 {
237
238 const std::tuple<uint32_t, uint32_t> SELECTED_SHIP_GRID_LOCATION = Terminal::GetUserCommandFromGameGrid({startingRow, startingColumn}, m_pageBuilder, m_gameInformation, false);
239
240 if (ValidateUserShipPosition(currentShipPositions, SELECTED_SHIP_GRID_LOCATION, shipIsHorizontal, shipIsVertical))
241 {
242 currentShipPositions.push_back(SELECTED_SHIP_GRID_LOCATION);
243
244 // Place ship on selected grid location
245 m_boardPlayerOne.at(std::get<0>(SELECTED_SHIP_GRID_LOCATION)).at(std::get<1>(SELECTED_SHIP_GRID_LOCATION)) = Globals::G_BATTLESHIPS_SHIP_PLACED_NAMES.at(currentShip);
246
248
249 break;
250 }
251 }
252
254 {
255 if (currentShipSize != 0)
256 {
257 // Undo previous ship placement and refresh display
258 m_boardPlayerOne.at(std::get<0>(currentShipPositions.back())).at(std::get<1>(currentShipPositions.back())) = Globals::G_BATTLESHIPS_EMPTY_GRID_VALUE;
259 currentShipPositions.pop_back();
262
263 // Go back one in for loop (and another -1 to account for increment)
264 currentShipSize -= 2;
265 break;
266 }
267 }
268 }
269 }
270
271 // Update the last known ship grid location selection for what will be the previous currentShip
272 lastShipStartingRow = std::get<0>(currentShipPositions.back());
273 lastShipStartingColumn = std::get<1>(currentShipPositions.back());
274 }
275 }
276
278 const std::vector<std::tuple<uint32_t, uint32_t>>& p_currentShipPositions,
279 const std::tuple<uint32_t, uint32_t>& p_selectedShipGridLocation,
280 bool& p_shipIsHorizontal,
281 bool& p_shipIsVertical)
282 {
283 // This function is assumed to be only called during one player games where player one is the user and player two is the
284 // computer. Therefore, user commands will be executed against player ones's board (m_boardPlayerOne).
285
286 const uint32_t SELECTED_SHIP_GRID_ROW = std::get<0>(p_selectedShipGridLocation);
287 const uint32_t SELECTED_SHIP_GRID_COLUMN = std::get<1>(p_selectedShipGridLocation);
288
289 if (m_boardPlayerOne.at(SELECTED_SHIP_GRID_ROW).at(SELECTED_SHIP_GRID_COLUMN) != Globals::G_BATTLESHIPS_EMPTY_GRID_VALUE)
290 {
291 return false;
292 }
293
294 // If this is empty then this is the first ship grid location selection so it is automatically valid
295 if (p_currentShipPositions.empty())
296 {
297 return true;
298 }
299
300 // As selected grid locations are added incrementally only the previous selection needs to be checked against the
301 // current selection
302 const uint32_t PREVIOUS_SELECTED_SHIP_GRID_ROW = std::get<0>(p_currentShipPositions.back());
303 const uint32_t PREVIOUS_SELECTED_SHIP_GRID_COLUMN = std::get<1>(p_currentShipPositions.back());
304
305 const bool ROWS_ARE_THE_SAME = PREVIOUS_SELECTED_SHIP_GRID_ROW == SELECTED_SHIP_GRID_ROW;
306 const bool COLUMNS_ARE_THE_SAME = PREVIOUS_SELECTED_SHIP_GRID_COLUMN == SELECTED_SHIP_GRID_COLUMN;
307
308 // Prevent selection of a diagonal grid location relative to the previous selection
309 if (!ROWS_ARE_THE_SAME && !COLUMNS_ARE_THE_SAME)
310 {
311 return false;
312 }
313
314 const int32_t ROW_DIFFERENCE_TO_PREVIOUS_SELECTION = std::abs(static_cast<int32_t>(SELECTED_SHIP_GRID_ROW) - static_cast<int32_t>(PREVIOUS_SELECTED_SHIP_GRID_ROW));
315 const int32_t COLUMN_DIFFERENCE_TO_PREVIOUS_SELECTION = std::abs(static_cast<int32_t>(SELECTED_SHIP_GRID_COLUMN) - static_cast<int32_t>(PREVIOUS_SELECTED_SHIP_GRID_COLUMN));
316
317 // Only allow adjacents grid locations relative to the previous selection
318 if ((ROW_DIFFERENCE_TO_PREVIOUS_SELECTION > 1) || (COLUMN_DIFFERENCE_TO_PREVIOUS_SELECTION > 1))
319 {
320 return false;
321 }
322
323 // If there has only been one selection yet this selection is automatically valid. Also as there have now been two
324 // selections we can determine whether the ship is being placed horizontally or vertically.
325 if (p_currentShipPositions.size() == 1)
326 {
327 p_shipIsHorizontal = ROWS_ARE_THE_SAME;
328 p_shipIsVertical = COLUMNS_ARE_THE_SAME;
329 return true;
330 }
331
332 // If ship is known to be horizontal then rows must be the same
333 if (p_shipIsHorizontal && !ROWS_ARE_THE_SAME)
334 {
335 return false;
336 }
337
338 // If ship is known to be vertical then columns must be the same
339 if (p_shipIsVertical && !COLUMNS_ARE_THE_SAME)
340 {
341 return false;
342 }
343
344 return true;
345 }
346
347 void Battleships::GetRandomShipPositions(std::array<std::array<std::string, Globals::G_BATTLESHIPS_BOARD_WIDTH>, Globals::G_BATTLESHIPS_BOARD_HEIGHT>& p_board) // NOLINT(readability-function-cognitive-complexity)
348 {
349 // For each ship
350 for (uint32_t currentShip = 0; currentShip < Globals::G_BATTLESHIPS_SHIP_COUNT; currentShip++)
351 {
352 std::vector<std::tuple<uint32_t, uint32_t>> shipPositions;
353 uint32_t startingRow = 0;
354 uint32_t startingColumn = 0;
355 bool locationIsAlreadyOccupied = false;
356
357 while (true)
358 {
359 shipPositions.clear();
360 locationIsAlreadyOccupied = false;
361
362 // Get a random ship orientation
363 if (static_cast<bool>(m_randomNumberGenerator() % 2)) // Horizontal
364 {
365 // As the ship will be placed horizontally and assuming the first column value will be the smallest and all
366 // other column values will increment, then a max possible starting column value exists which is linked with
367 // the size of the ship. Therefore get a random value from 0 to the max possible starting column value.
368
369 startingRow = m_randomNumberGenerator() % Globals::G_BATTLESHIPS_BOARD_HEIGHT; // Any row value allowed as ship is horizontal
370
372
373 // Column values increment by one
374 for (uint32_t columnIncrement = 0; columnIncrement < Globals::G_BATTLESHIPS_SHIP_SIZES.at(currentShip); columnIncrement++)
375 {
376 if (p_board.at(startingRow).at(startingColumn + columnIncrement) == Globals::G_BATTLESHIPS_EMPTY_GRID_VALUE)
377 {
378 shipPositions.emplace_back(startingRow, startingColumn + columnIncrement);
379 }
380
381 else
382 {
383 locationIsAlreadyOccupied = true;
384 break;
385 }
386 }
387 }
388
389 else // Vertical
390 {
391 // As the ship will be placed vertically and assuming the first row value will be the smallest and all other
392 // row values will increment, then a max possible starting row value exists which is linked with the size of
393 // the ship. Therefore get a random value from 0 to the max possible starting row value.
394
396
397 startingColumn = m_randomNumberGenerator() % Globals::G_BATTLESHIPS_BOARD_WIDTH; // Any column value allowed as ship is vertical
398
399 // Row values increment by one
400 for (uint32_t rowIncrement = 0; rowIncrement < Globals::G_BATTLESHIPS_SHIP_SIZES.at(currentShip); rowIncrement++)
401 {
402 if (p_board.at(startingRow + rowIncrement).at(startingColumn) == Globals::G_BATTLESHIPS_EMPTY_GRID_VALUE)
403 {
404 shipPositions.emplace_back(startingRow + rowIncrement, startingColumn);
405 }
406
407 else
408 {
409 locationIsAlreadyOccupied = true;
410 break;
411 }
412 }
413 }
414
415 if (!locationIsAlreadyOccupied)
416 {
417 break;
418 }
419 }
420
421 // Place ship
422 for (std::tuple<uint32_t, uint32_t> currentShipPosition : shipPositions)
423 {
424 p_board.at(std::get<0>(currentShipPosition)).at(std::get<1>(currentShipPosition)) = Globals::G_BATTLESHIPS_SHIP_PLACED_NAMES.at(currentShip);
425 }
426 }
427 }
428
429 bool Battleships::IsShipPresent(std::array<std::array<std::string, Globals::G_BATTLESHIPS_BOARD_WIDTH>, Globals::G_BATTLESHIPS_BOARD_HEIGHT>& p_board)
430 {
431 for (const std::array<std::string, Globals::G_BATTLESHIPS_BOARD_WIDTH>& currentRow : p_board)
432 {
433 for (const std::string& currentBoardValue : currentRow)
434 {
436 {
437 return true;
438 }
439 }
440 }
441
442 return false;
443 }
444
445 bool Battleships::ValidateCommand(const std::vector<std::tuple<uint32_t, uint32_t>>& p_commandsRemaining, const std::tuple<uint32_t, uint32_t>& p_command)
446 {
447 const auto COMMAND_FIND_LOCATION = Globals::ImplementStdRangesFind(p_commandsRemaining.begin(), p_commandsRemaining.end(), p_command);
448
449 return COMMAND_FIND_LOCATION != p_commandsRemaining.end();
450 }
451
453 std::array<std::array<std::string, Globals::G_BATTLESHIPS_BOARD_WIDTH>, Globals::G_BATTLESHIPS_BOARD_HEIGHT>& p_opponentBoard,
454 std::unordered_map<std::string, uint32_t>& p_opponentShipsRemaining,
455 std::vector<std::tuple<uint32_t, uint32_t>>& p_commandsRemaining,
456 const std::tuple<uint32_t, uint32_t>& p_command)
457 {
458 const auto COMMAND_FIND_LOCATION = Globals::ImplementStdRangesFind(p_commandsRemaining.begin(), p_commandsRemaining.end(), p_command);
459 const uint32_t ROW = std::get<0>(p_command);
460 const uint32_t COLUMN = std::get<1>(p_command);
461
462 // If board value contains a ship then it is a hit
464 {
465 p_opponentShipsRemaining.at(p_opponentBoard.at(ROW).at(COLUMN))--;
466 p_opponentBoard.at(ROW).at(COLUMN) = Globals::G_BATTLESHIPS_SUCCESSFUL_ATTACK + p_opponentBoard.at(ROW).at(COLUMN).substr(Globals::G_BATTLESHIPS_GRID_ELEMENT_WIDTH, p_opponentBoard.at(ROW).at(COLUMN).size() - 1);
467 }
468
469 else // Miss
470 {
471 p_opponentBoard.at(ROW).at(COLUMN) = Globals::G_BATTLESHIPS_MISSED_ATTACK + p_opponentBoard.at(ROW).at(COLUMN).substr(Globals::G_BATTLESHIPS_GRID_ELEMENT_WIDTH, p_opponentBoard.at(ROW).at(COLUMN).size() - 1);
472 }
473
474 p_commandsRemaining.erase(COMMAND_FIND_LOCATION);
475 m_turnCount++;
476 }
477}
void ResetGame() override
Update variables to allow for the game to be reset and so the user will be asked for new options.
void ExecuteComputerCommand() override
Get a random command from the computer.
uint32_t m_turnCount
The number of turns that have occurred.
std::unordered_map< std::string, uint32_t > m_shipsRemainingPlayerOne
The respective player's health of each their ships.
bool IsCurrentTurnUsers() override
Check whether the current turn should be executed by the user.
std::vector< std::tuple< uint32_t, uint32_t > > m_commandsRemainingPlayerOne
The respective player's board <row, column> values they have not chosen yet.
GameInformation m_gameInformation
Used to package up the current state of the game so it can be used by m_pageBuilder.
std::string m_playerCount
The count of the user selected number of players.
std::tuple< uint32_t, uint32_t > m_previousCommand
The previous board <row, column> value that was chosen by the user. This is used to return the cursor...
Battleships(const bool &p_useAnsiEscapeCodes)
Constructs a new Battleships object.
void UpdateGameInformation() override
Updates GameInformation to match the current state of the game.
void GameOver() override
Display the game over message and prompt the user whether they would like to play again or quit the g...
PageBuilder m_pageBuilder
Used to build pages required by the game.
void ExecuteUserCommand() override
Prompt the user to enter their command for the current turn.
void ExecuteGeneralCommand(std::array< std::array< std::string, Globals::G_BATTLESHIPS_BOARD_WIDTH >, Globals::G_BATTLESHIPS_BOARD_HEIGHT > &p_opponentBoard, std::unordered_map< std::string, uint32_t > &p_opponentShipsRemaining, std::vector< std::tuple< uint32_t, uint32_t > > &p_commandsRemaining, const std::tuple< uint32_t, uint32_t > &p_command)
Executes the command on the opponent's board and updates their own board and commands remaining.
void RestartGame() override
Update variables to allow for the game to be restarted with the same user options.
void GetPlayerCount()
Prompts the user to select how many players will be playing the game.
bool m_isGameOver
Whether the game is over (true) or not (false).
std::unordered_map< std::string, uint32_t > m_shipsRemainingPlayerTwo
The respective player's health of each their ships.
std::array< std::array< std::string, Globals::G_BATTLESHIPS_BOARD_WIDTH >, Globals::G_BATTLESHIPS_BOARD_HEIGHT > m_boardPlayerTwo
The current state of the respective player's board.
void GetUserShipPositions()
Prompt the user to place all ships on the board.
std::array< std::array< std::string, Globals::G_BATTLESHIPS_BOARD_WIDTH >, Globals::G_BATTLESHIPS_BOARD_HEIGHT > m_boardPlayerOne
The current state of the respective player's board.
static bool ValidateCommand(const std::vector< std::tuple< uint32_t, uint32_t > > &p_commandsRemaining, const std::tuple< uint32_t, uint32_t > &p_command)
Checks whether the command is valid.
void GetComputerSpeed()
Prompts the user to select how the speed of the computer decision making (this does not affect the di...
std::vector< std::tuple< uint32_t, uint32_t > > m_commandsRemainingPlayerTwo
The respective player's board <row, column> values they have not chosen yet.
void SetupGame() override
Clears and sets all member variables to their game start default.
std::string m_currentPlayer
The name of the player whose turn it is.
void GetRandomShipPositions(std::array< std::array< std::string, Globals::G_BATTLESHIPS_BOARD_WIDTH >, Globals::G_BATTLESHIPS_BOARD_HEIGHT > &p_board)
Randomly place all ships on the board and is used to place the computer's ships.
bool IsGameOver() override
Check whether the game is over.
static bool IsShipPresent(std::array< std::array< std::string, Globals::G_BATTLESHIPS_BOARD_WIDTH >, Globals::G_BATTLESHIPS_BOARD_HEIGHT > &p_board)
Checks whether at least a single ship is present on a game board.
std::string m_computerSpeedName
The name of the user selected computer speed.
void ToggleCurrentPlayer() override
Change the current player to the other player.
uint32_t m_computerSpeed
The computer speed determined by the amount of seconds the computer must wait before executing it's c...
bool m_saveGameOptions
Whether to save the user's currently selected game options (true) and restart the game or not (false)...
bool ValidateUserShipPosition(const std::vector< std::tuple< uint32_t, uint32_t > > &p_currentShipPositions, const std::tuple< uint32_t, uint32_t > &p_selectedShipGridLocation, bool &p_shipIsHorizontal, bool &p_shipIsVertical)
Validates whether (true) or not (false) p_selectedShipGridLocation is a valid grid location to place ...
void GetUserOptions() override
Prompt the user for their choice on various game-related options.
bool m_hasSavedGameOptions
Whether the user has selected all the game options (true) or not/partially (false)....
std::default_random_engine m_randomNumberGenerator
Used to randomly select ships positions for the computer and randomly select board <row,...
Used when the backspace key is pressed.
Definition Globals.hpp:61
static void GetUserChoiceFromGameOverMenu(const std::string &p_gameOverPage, const std::vector< std::string > &p_quitOptionMenus)
Get the user choice whether to restart the game, reset the game or a choice from the GetUserChoiceFro...
Definition Terminal.cpp:311
static void PrintOutput(const std::string &p_output)
Clears and then prints to the terminal.
Definition Terminal.cpp:381
static uint32_t GetUserChoiceFromGameMenus(const std::vector< std::string > &p_menus, const std::vector< std::string > &p_quitOptionMenus)
Get the user choice from a list of game menus screens that are printed to the terminal.
Definition Terminal.cpp:83
static std::tuple< uint32_t, uint32_t > GetUserCommandFromGameGrid(const std::tuple< uint32_t, uint32_t > &p_startingGridLocation, const PageBuilder &p_pageBuilder, const GameInformation &p_gameInformation, const bool &p_displayGetUserCommandPage)
Gets a user command based on the currently displayed game grid (wrapper function around the platform-...
Definition Terminal.cpp:114
static const uint32_t G_BATTLESHIPS_SHIP_COUNT
Battleships number of ships for each board/player.
Definition Globals.hpp:1629
static const std::array< std::string, G_BATTLESHIPS_SHIP_COUNT > G_BATTLESHIPS_SHIP_PLACED_NAMES
Battleships list of ship names when placed on a board.
Definition Globals.hpp:1679
static const uint32_t G_BATTLESHIPS_SUBMARINE_SIZE
Battleships ship-related constants used in later arrays.
Definition Globals.hpp:1638
static constexpr T ImplementStdRangesFind(const T &p_begin, const T &p_end, const U &p_value)
Implements std::ranges::find which should work for all standard template library containers.
Definition Globals.hpp:86
static const std::string G_BATTLESHIPS_SUCCESSFUL_ATTACK
Battleships board values.
Definition Globals.hpp:1614
static const std::string G_BATTLESHIPS_MISSED_ATTACK
Battleships board values.
Definition Globals.hpp:1612
static const uint32_t G_BATTLESHIPS_BOARD_WIDTH
Battleships board attributes.
Definition Globals.hpp:1576
static const std::string G_BATTLESHIPS_DESTROYER_PLACED_NAME
Battleships ship-related constants used in later arrays.
Definition Globals.hpp:1649
static const std::string G_BATTLESHIPS_BATTLESHIP_PLACED_NAME
Battleships ship-related constants used in later arrays.
Definition Globals.hpp:1648
static const std::array< std::string, G_GAME_TWO_OPTIONS > G_BATTLESHIPS_PLAYER_CHOICE_OPTIONS
Battleships player choice options.
Definition Globals.hpp:1623
static const std::string G_BATTLESHIPS_PLAYER_ONE
Battleships player choice options.
Definition Globals.hpp:1621
static const uint32_t G_BATTLESHIPS_PATROL_BOAT_SIZE
Battleships ship-related constants used in later arrays.
Definition Globals.hpp:1639
static const uint32_t G_BATTLESHIPS_GRID_ELEMENT_WIDTH
Battleships board attributes.
Definition Globals.hpp:1578
static const uint32_t G_BATTLESHIPS_BATTLESHIP_SIZE
Battleships ship-related constants used in later arrays.
Definition Globals.hpp:1636
static const std::string G_BATTLESHIPS_PLAYER_TWO
Battleships player choice options.
Definition Globals.hpp:1622
static const uint32_t G_BATTLESHIPS_DESTROYER_SIZE
Battleships ship-related constants used in later arrays.
Definition Globals.hpp:1637
static const uint32_t G_BATTLESHIPS_CARRIER_SIZE
Battleships ship-related constants used in later arrays.
Definition Globals.hpp:1635
static const std::string G_BATTLESHIPS_EMPTY_GRID_VALUE
Battleships board values.
Definition Globals.hpp:1611
static const std::string G_BATTLESHIPS_PATROL_BOAT_PLACED_NAME
Battleships ship-related constants used in later arrays.
Definition Globals.hpp:1651
static const std::vector< std::string > G_GAME_COMPUTER_SPEED_OPTIONS
Used by multiple games or an attribute not specific to one game.
Definition Globals.hpp:385
static const std::string G_BATTLESHIPS_SUBMARINE_PLACED_NAME
Battleships ship-related constants used in later arrays.
Definition Globals.hpp:1650
static const std::vector< std::string > G_GAME_MAX_ONE_PLAYER_OPTIONS
Used by multiple games or an attribute not specific to one game.
Definition Globals.hpp:387
static const std::array< std::string, G_BATTLESHIPS_SHIP_COUNT > G_BATTLESHIPS_SHIP_INSTRUCTIONS
Battleships list of instructions use when asking the user for the grid locations for their ships.
Definition Globals.hpp:1657
static const std::array< uint32_t, G_BATTLESHIPS_SHIP_COUNT > G_BATTLESHIPS_SHIP_SIZES
Battleships list of ship sizes.
Definition Globals.hpp:1690
static const uint32_t G_BATTLESHIPS_BOARD_HEIGHT
Battleships board attributes.
Definition Globals.hpp:1577
static const std::string G_BATTLESHIPS_CARRIER_PLACED_NAME
Battleships ship-related constants used in later arrays.
Definition Globals.hpp:1647
static const std::string G_GAME_UNKNOWN_OPTION
Used by multiple games or an attribute not specific to one game.
Definition Globals.hpp:382
Contains all Terminal-Games objects.
@ BATTLESHIPS
Page supported by PageBuilder.