Commit 4e419e88 authored by theray1's avatar theray1
Browse files

Ajout score

parent 7e4118fd
......@@ -46,11 +46,15 @@ public class Partie {
public void finirPartie() {
//TODO : implementer
int score = calculeScore();
System.out.println(score > 0? "Bleu gagne" : "Rouge gagne");
}
public int calculeScore() {
int score = this.getPlateau().calculeScore();
int score = 0;
score = this.getPlateau().calculeScore();
setScore(score);
return score;
}
......
......@@ -205,9 +205,19 @@ public class Plateau{
public int calculeScore() {
//TODO : METHODE OBLIGATOIRE
int[] temp = this.getArbrePlateau().getRoot().calculeScoreNaif();
return temp[0] - temp[1];
int b = 0;
int r = 0;
for(int i = 0; i < this.longueur; i++){
for (int j = 0; j < this.longueur; j++){
if(this.matrice[i][j].getCouleur() == Couleur.B){
b++;
}
if(this.matrice[i][j].getCouleur() == Couleur.R){
r++;
}
}
}
return b-r;
}
//GETTERS SETTERS
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment