-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPionNoir.java
More file actions
executable file
·32 lines (27 loc) · 837 Bytes
/
Copy pathPionNoir.java
File metadata and controls
executable file
·32 lines (27 loc) · 837 Bytes
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
/**
* Classe PionBlanc. Hérite de la classe pion, spécifie le cas d'un pion blanc.
*
* @author (Emeric de Bernis)
*/
public class PionNoir extends Pion {
public PionNoir(Backgammon world, Colonne col) {
super(world, col);
this.setImage("images/pionnoir.png");
}
public String getColor() {
return "noir";
}
public void isReadyToLeave() {
if (this.getCol().getId()<7) setReadyToLeave(true);
}
public boolean onTheWayOut() {
return this.X > 745 && this.X < 770 && this.Y > 310 && this.Y < 600;
}
public boolean areColumnsBeforeEmpty() {
boolean cond = true;
for (int i = this.getCol().getId()+1; i<7; i++) {
cond = cond && (this.world.getColumns().get(i).isEmpty() || (this.world.getColumns().get(i).getLast().getColor() != this.getColor()));
}
return cond;
}
}