-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBoard.h
63 lines (44 loc) · 1.07 KB
/
Board.h
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
59
60
61
62
63
// Board.h
// Arsh Chauhan and Tristan Craddick
// 02/17/2016
// Last Edited: 03/10/2016
// For CS 372 Battleship Game
#ifndef BOARD_H_INCLUDED
#define BOARD_H_INCLUDED
#include "Cell.h"
#include <vector>
using std::vector;
#include <cstddef>
using std::size_t;
/*****************Prototypes********************/
class Board
{
public:
bool isOccupied(int,int);
bool isPrimary();
int getSize();
void setSize(int size);
/*****************functions to act on our board's cells********************/
int totalCells();
void setHead(int,int);
void setOccupied(int,int);
bool isHead(int,int);
vector<vector<Cell>> board_; //Collection of cells
int ship_cells[5]; //the number of cells remaining for each ship
private:
int boardSize_;
int totalCells_;
bool squareOccupied_;
bool isPrimary_;
public:
/*****************Constructors********************/
Board (int size, bool isPrimary):boardSize_(size),totalCells_(size*size),isPrimary_(isPrimary)
{
board_.resize(boardSize_);
for (int i = 0; i < boardSize_; i++)
{
board_[i].resize(boardSize_);
}
}
};
#endif