-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBoard.h
More file actions
58 lines (34 loc) · 1.02 KB
/
Copy pathBoard.h
File metadata and controls
58 lines (34 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//
// Created by Sptrp on 17.04.21.
//
#ifndef BATTLE_SHIPS_BOARD_H
#define BATTLE_SHIPS_BOARD_H
#include <vector>
#include <map>
class Board {
private:
std::vector< std::vector<bool> > board;
std::vector< std::vector<int> > blacklist;
std::map< std::vector<int>, int > shipStorage;
std::map<int, int> shipMap;
std::vector<int> sankShips;
std::vector<int> RandomizeCoordinate();
void PlaceVarFieldsShip(int size);
void StoreFieldInBlackList(int y, int x);
bool IsWithinGrid(int rowNum, int colNum);
bool IsInBlacklist(int col, int row);
int CountFreeCols(int *row);
int CountFreeRows(int *col);
bool IsSlotFree(int col, int row, int size, int rotation);
void OccupyField(int col, int row);
void PutInStorage(int col, int row, int size);
void PutInMap(int size);
bool IsShipSunk(int const *size);
public:
Board(int multiplier);
~Board();
void RandomizeShips();
int AttackField();
void PrintBoard();
};
#endif //BATTLE_SHIPS_BOARD_H