-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBoard.h
56 lines (41 loc) · 1.14 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
#ifndef BOARD_H
#define BOARD_H
#include <fstream>
class Board;
#include "Cell.h"
class Board
{
private:
///
/// A two-dimensional array, which holds all cells in the labyrinth
///
Cell** ppBoard;
/// The number of rows in the board
int RowsCount;
/// The number of columns in the board
int ColsCount;
private:
Cell** AllocateNewBoard(int RowsCount, int ColsCount);
void FreeBoard(Cell**& ppBoard, int RowsCount);
Cell** DuplicateBoard(const Cell** ppBoard, int RowsCount, int ColsCount);
Cell** DuplicateBoard(const Board & board);
void SetAsOwnerFor(Cell** ppBoard, int RowsCount, int ColsCount);
private:
static bool GetBoardDimensionsFromFile(std::ifstream & InputFile, int& RowsCount, int& ColsCount);
void ReadBoardFromFile(std::ifstream & InputFile, Cell ** ppBoard);
public:
Board();
Board(const Board & board);
~Board();
Board & operator=(Board const & board);
public:
int GetRowsCount() const;
int GetColsCount() const;
bool LoadFromFile(const char* Filename);
Cell* GetCell(int Row, int Col) const;
Cell* GetStart() const;
Cell* GetEnd() const;
void Print() const;
void MarkAllCellsNotVisited();
};
#endif // BOARD_H