-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCurrentGameInfo.java
More file actions
57 lines (50 loc) · 1.58 KB
/
Copy pathCurrentGameInfo.java
File metadata and controls
57 lines (50 loc) · 1.58 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
import java.util.ArrayList;
/**
* The class that stores the current game information to be retrieved when the undo button is pressed.
* @author: Hung Phan
* @author: Lien Cao
* @author: Wendy Ta
* @version: 1.0 11/28/25
*/
public class CurrentGameInfo {
private ArrayList<Pit> allPits; //stores all info about all the pits including name and stones
private ArrayList<Pit> allPitsCopy;
private String curPlayer;
private boolean freeTurn;
/**
* Constructs the game info
* @param allPits the list of the pits in the game
* @param curPlayer the player
* @param freeTurn true if has free turn, false otherwise
*/
public CurrentGameInfo(ArrayList<Pit> allPits, String curPlayer, boolean freeTurn) {
this.allPits = allPits;
this.curPlayer = curPlayer;
this.freeTurn = freeTurn;
allPitsCopy = new ArrayList<>(); //own copy of the pits, not referencing updated allPits from model
for (Pit p : allPits) {
allPitsCopy.add(new Pit(p.getName(), p.getX(), p.getY(), p.getWidth(), p.getHeight(), p.getNumStones()));
}
}
/**
* Gets the copy of the pits
* @return the list of pits
*/
public ArrayList<Pit> getAllPitsCopy() {
return this.allPitsCopy;
}
/**
* Gets the current player
* @return the current player
*/
public String getCurrentPlayer() {
return curPlayer;
}
/**
* Gets the free turn
* @return true if has free turn, false otherwise
*/
public boolean getFreeTurn() {
return this.freeTurn;
}
}