Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Erwan BOISTEAU-DESDEVISES
projet-asd-3
Commits
4e419e88
Commit
4e419e88
authored
Nov 26, 2021
by
theray1
Browse files
Ajout score
parent
7e4118fd
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/project/Partie.java
View file @
4e419e88
...
...
@@ -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
;
}
...
...
src/project/Plateau.java
View file @
4e419e88
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment