-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMinesweeperBoard.java
119 lines (102 loc) · 2.91 KB
/
MinesweeperBoard.java
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
package cs305.minesweeper;
import java.awt.Dimension;
/**
* A representation of a board in the game Minesweeper
*
* @author Michael Sergio
*/
public interface MinesweeperBoard {
/**
* State of the Game
*/
enum GameState {
/**
* A pre-game state
*/
Waiting,
/**
* The game during it's play state
*/
Playing,
/**
* A post-game state representing a loss
*/
Lost,
/**
* A post-game lost representing a win
*/
Won
};
/**
* Gets the size of the board.
* For example, a 1 X 1 board will return [1,1], a 2 x 2 board will return [2,2]
* @return A dimension containing: [The length of X, The length of Y]
*/
Dimension getBoardSize();
/**
* Gets the state of the game
* @return the game state
*/
GameState getGameState();
/**
* Gets a tile at a particular position on the board
* @param x The 0-based X position
* @param y The 0-based Y position
* @return A MinesweeperTile at [x,y]
*/
MinesweeperTile getTile(int x, int y);
/**
* Gets an array containing a references to all tiles on the board
* @return All the tiles on the board
*/
MinesweeperTile[] getAllTiles();
/**
* Gets an array containing references to all the hidden tiles on the board.
* @return All the hidden tiles on the board
*/
MinesweeperTile[] getHiddenTiles();
/**
* returns all the Tiles that are exposed and have a value range between 0 an 9
* not including 0 or 9
* @return All exposed tiles that have a number value
*/
MinesweeperTile[] getNumberTiles();
/**
* displays the board of the game
*/
void displayBoard();
/**
* resets the board for a new game
*/
void resetBoard();
/**
* Flags a tile on the board.
* Flagging means the user thinks there is a bomb at that spot.
* Flagging a tile will marked the tile as flagged.
* @param tile A valid reference to a title on the board
*/
void flagTile(MinesweeperTile tile);
/**
* Flags a tile on the board.
* Flagging means the user thinks there is a bomb at that spot.
* Flagging a tile will marked the tile as flagged.
* @param x A valid X position between 0 and size - 1
* @param y A valid Y position between 0 and size - 1
*/
void flagTile(int x, int y);
/**
* Clicks a tile on the board.
* Clicking means the user thinks there is no bomb at that spot.
* Clicking a title exposes the tile and may change the game state if it is a bomb.
* @param tile A valid reference to a title on the board
*/
void clickTile(MinesweeperTile tile);
/**
* Clicks a tile on the board.
* Clicking means the user thinks there is no bomb at that spot.
* Clicking a title exposes the tile and may change the game state if it is a bomb.
* @param x A valid X position between 0 and size - 1
* @param y A valid Y position between 0 and size - 1
*/
void clickTile(int x, int y);
}