-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathBoard.java
More file actions
97 lines (72 loc) · 2.42 KB
/
Board.java
File metadata and controls
97 lines (72 loc) · 2.42 KB
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
import java.util.ArrayList;
public class Board<Square> {
boolean squareOccupied ;
int numOfBluecards = 0;
String drill;
private Square[] nw = new Square[7];
public int emptySquares(){ //Method that checks if there are any emptysquares in the array
int count = 0; //Start count at 0
for (Square nw : Square) { //For loop
if ( (boolean) (nw = null) ){ //Check for null elements
count++; //Increment count
}
}
return count;
}
//write a method that will return a Square array with occupied squares...calcualting amount in phase 3
public void blueCardPlacement() { //Method that will add a blue card to a square
for (int i=0; i <= Square.length; i++) { //Loop through array
if (Square[i] == null) { //Check there's space
Square[i] = BlueCards.dealCard(); //Call method from BlueCards
}
}
}
public boolean isSquareOccupied() {
return squareOccupied;
}
public void setSquareOccupied(boolean squareOccupied) {
this.squareOccupied = squareOccupied;
}
public int getNumOfBluecards() {
return numOfBluecards;
}
public void setNumOfBluecards(int numOfBluecards) {
this.numOfBluecards = numOfBluecards;
}
public String getDrill() {
return drill;
}
public void setDrill(String drill) {
this.drill = drill;
}
public Square[] getNw() {
return nw;
}
public void setNw(Square[] nw) {
this.nw = nw;
}
public void removeDrill() { // Method that will remove a drill from a square
int n = 0; //Local variable
while (n<7){ //While loop, will run while condition is true
Square[i] = Square [Square.length-1]; //Delete element from array
}
}
public void addDrill() { //Method that will add a drill to the square
int index=0; //Set index to )
while (index < Square.length()) { //While the index is less than array length
nw.add(new drill); //Add a drill
index++; //Increment index
}
public void playerPlacement() { // Method that assigns a player to a square
for (int i=0; i <= Square.length; i++) { //Loop through array
if ( (blueCard == false) && (player == Bank.buyConc.player) ) { //If square is empty and player has won the bid
nw.add(new player); //Add player to array
squareOccupied = true; //Set square to occupied
numOfBluecards++; //Increment array index
else {
System.out.println("No empty site in North-West");
}
}
}
}
}