-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathboard.hpp
98 lines (65 loc) · 1.82 KB
/
board.hpp
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
//
// Copyright Erik Bryant ([email protected])
//
#include <vector>
#include "statistics.hpp"
#include "cell.hpp"
#define LEVEL_EASY 0
#define LEVEL_MEDIUM 1
#define LEVEL_HARD 2
class Board {
public:
Statistics stats;
private:
char name[255];
int rows;
int cols;
unsigned int difficulty;
int mines[3];
bool initialized;
Cell **cells;
int curR;
int curC;
public:
Board();
void deinit();
~Board();
void readFile( string filename );
void startNewGame();
unsigned char countNeighbors( int r, int c );
int countFlags();
void print( bool showColorVal );
//
// Take the cap off and reveal the cell underneath.
// Returns True if there is a mine. False otherwise.
//
bool reveal();
void unreveal();
void revealAll();
void toggleFlag();
void toggleQuestion();
void setDifficulty( unsigned int d );
bool isSolved();
void move( int r, int c );
bool findUnmarkedMine( int *row, int *col );
bool findWronglyFlaggedMine( int *row, int *col );
bool findEmptyCellWithCap( int *row, int *col );
void hint();
//
// Functions used by the editor
//
void setCell( unsigned int color, bool mirror );
void fillCells( unsigned int color, bool mirror );
void deleteRow();
void deleteCol();
void insertRowAbove();
void insertRowBelow();
void insertColLeft();
void insertColRight();
void writeFile( char *filename );
void replaceColor( unsigned int oldColor, unsigned int newColor );
private:
bool reveal( int r, int c );
void setCell( int r, int c, unsigned int color, bool mirror );
void fillCellsHelper( int r, int c, unsigned int color, bool mirror );
};