-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayer.java
More file actions
69 lines (58 loc) · 1.34 KB
/
Copy pathPlayer.java
File metadata and controls
69 lines (58 loc) · 1.34 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
import java.util.*;
public class Player{
private Plateau plateau; // plateau en jeu
private int couleur; // Blanc = 0, Noir = 1
private String nom; // nom du joueur
private int numPiecesRest; // Nombre total de piece restante par joueur(max=16)
// Constructeur par défaut
public Player(){
}
// Constructeur pour choisir la couleur
public Player(int couleur){
this.couleur = couleur;
}
// Constructeur por nom + couleur
public Player(int couleur, String nom){
this.couleur = couleur;
this.nom = nom;
}
// get Plateau
private Plateau getPlateau(){
return plateau;
}
// get couleur
public int getCouleur(){
return couleur;
}
// set couleur
public void setCouleur(int couleur){
this.couleur = couleur;
}
// Retourne couleur ennemie
public int getEnnemieCouleur(){
if(getCouleur() == 0){
return 1;
} else {
return 0;
}
}
// get nom
public String getNom(){
return nom;
}
// set nom
public void setNom(String nom){
this.nom = nom;
}
// get le nombre piece restantes
public int getNumPiecesRest(){
ArrayList<Piece> pieces = getPlateau().getPieces(); // get les piece en jeu
int numRest = 0;
for(Piece p : pieces){
if(p.getCouleur() == couleur){ // Si meme couleur, incrémente numRest
numRest++;
}
}
return numRest;
}
}