-
Notifications
You must be signed in to change notification settings - Fork 1
/
Board.java
executable file
·38 lines (34 loc) · 1.05 KB
/
Board.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
/**
* Board: A n x m game board made of of individualab tiles.
*
* For the game of concentraiton",the board is made up of
* pairs of matching strings, one string per tile.
*
* Precondition: the size of the cards array must fit into the rows/columns shape of the board
*/
public abstract class Board
{
//The cards that will be placed in the tiles
private String[] cards = new String[] {"dog", "dog", "cat", "cat", "mouse", "mouse",
"wolf", "wolf", "monkey", "monkey", "bird", "bird"};
// The shape of the board
private int rows = 3;
private int columns = 4;
/**
* Create a 2-dim array to represent a game board and return it
*
* @return a game board of tiles with dimension rows x columns
*/
public Tile[][] makeBoard() {
return new Tile[rows][columns];
}
/**
* Return the array of cards
*
* @return a String array of card values
*
*/
public String[] getCards () {
return cards;
}
}