-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMove.java
More file actions
88 lines (75 loc) · 1.8 KB
/
Copy pathMove.java
File metadata and controls
88 lines (75 loc) · 1.8 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
/**
* Move.java
*
* @author Deep Patel
*
* REMARKS: This class is used to store the move taking place, which includes
* where the piece is moving from to where its moving to, as well as if the move is
* valid and if the user wants to forfeit
*/
public class Move {
//Instance variables
private int fromRow;
private int fromCol;
private int toRow;
private int toCol;
private boolean isValid;
private boolean isForfeit;
private Piece piece;
private Piece prevPiece;
//Constructor
Move(int fromRow, int fromCol, int toRow, int toCol, boolean isValid, boolean isForfeit) {
this.fromRow = fromRow;
this.fromCol = fromCol;
this.toRow = toRow;
this.toCol = toCol;
this.isValid = isValid;
this.isForfeit = isForfeit;
this.piece = null;
this.prevPiece = null;
}
//Get the row piece is moved from
public int getFromRow(){
return fromRow;
}
//Get col piece is moved from
public int getFromCol(){
return fromCol;
}
//get row piece is moved to
public int getToRow(){
return toRow;
}
//get column piece is moved to
public int getToCol(){
return toCol;
}
//set isValid
public void setValid(boolean valid){
isValid = valid;
}
//set piece
public void setPiece(Piece p){
piece = p;
}
//get isValid
public boolean getValid(){
return isValid;
}
//get isForfeit
public boolean getForfeit(){
return isForfeit;
}
//get piece
public Piece getPiece(){
return piece;
}
//set previous piece moved
public void setPrevPiece(Piece p){
prevPiece = p;
}
//get previous piece
public Piece getPrevPiece(){
return prevPiece;
}
}