-
Notifications
You must be signed in to change notification settings - Fork 0
/
Piece.java
72 lines (56 loc) · 1.61 KB
/
Piece.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
public class Piece {
private boolean aBouger = false;
private Couleur couleur;
private boolean annulerCoupSpecial = false;
public Piece() {
}
public void setAnnulerCoupSpecial(boolean annulerCoupSpecial) {
this.annulerCoupSpecial = annulerCoupSpecial;
}
public boolean isAnnulerCoupSpecial() {
return annulerCoupSpecial;
}
public boolean isABouger() {
return aBouger;
}
public void setABouger(boolean aBouger) {
this.aBouger = aBouger;
}
public String getNom() {
return this.getClass().getSimpleName();
}
public boolean coupValide(int x, int y){
return false;
}
public Couleur getCouleur() {
return couleur;
}
public void setCouleur(Couleur couleur) {
this.couleur = couleur;
}
public String longueurString(String mot) {
while (mot.length() <= 12) {
mot += " ";
}
return mot;
}
public boolean coupDroit(int x, int y) {
return ((x <= 7 && x >= -7) && (y <= 7 && y >= -7) && (y == 0 || x == 0));
}
public boolean coupDiagone(int x, int y) {
return (x <= 7 && x >= -7) && ((y == x)) || (-y == x);
}
public boolean coupSpecialPossible() {
return false;
}
public boolean coupSpecialValide(int x, int y) {
return false;
}
public boolean ignoreTestSauter() {
return false;
}
@Override
public String toString() {
return longueurString(" " + getNom() + " " + getCouleur());
}
}