-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConfig.java
50 lines (46 loc) · 1 KB
/
Config.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
/**
* Config : game configuration file
*/
public abstract class Config {
/**
* The boats and their configuration
* {:id, :name, :size}
*/
private static final String[][] boats =
{
{"1", "Aircraft-Carrier", "5"},
{"2", "Battleship", "4",},
{"3", "Destroyer", "3"},
{"4", "Destroyer", "3"},
{"5", "Submarine", "2"}
};
/**
* Returns a given boat's configuration
*
* @param int boatId
*
* @return String[]
*/
public static String[] getBoatsConfig(int boatId) {
if (boatId < 0 || boatId >= boats.length) {
return new String[0];
}
return boats[boatId];
}
/**
* Returns the configuration of every boat
*
* @return String[][]
*/
public static String[][] getBoatsConfig() {
return boats;
}
/**
* Returns the number of boats
*
* @return int
*/
public static int getNbBoats() {
return boats.length;
}
}