Unit tests WinConditionHunter / Shadow

This commit is contained in:
Paul Gross
2020-04-20 12:38:06 +02:00
parent b6a1db9e3b
commit fb4e3c6c7c
10 changed files with 206 additions and 28 deletions

View File

@ -7,8 +7,6 @@ public class CarteLieu {
private String nom;
private CarteLieu voisin;
private Plateau plateau;
// TODO connaitre carte voisine sur un autre territoire pour emi?
public CarteLieu(String n, List<Integer> vals, CarteLieu vois, Plateau plat){
nom = n;

View File

@ -58,12 +58,17 @@ public class Joueur {
return this.equipe;
}
public int setStat(String key, int valeur) {
return stats.put(key, valeur);
public void setStat(String key, int valeur) {
this.stats.put(key, valeur);
}
public int getStat(String key) {
return stats.get(key);
if(stats.containsKey(key)) {
return stats.get(key);
}else {
return -1;
}
}
@ -134,4 +139,8 @@ public class Joueur {
}
public void setPlateau(Plateau plateau2) {
this.plateau = plateau2;
}
}

View File

@ -34,17 +34,18 @@ public class Plateau {
this.joueurs = joueurs;
this.lieux = new ArrayList<>();
stats = new HashMap<>();
this.stats = new HashMap<>();
// Initialisation plateau
stats.put(NB_HUNTERS, 0);
stats.put(NB_SHADOWS, 0);
stats.put(NB_NEUTRES, 0);
stats.put(NB_MORTS, 0);
stats.put(NB_MORTS_NEUTRAL, 0);
stats.put(NB_MORTS_HUNTER, 0);
stats.put(NB_MORTS_SHADOW, 0);
stats.put(PARTIE_FINIE, 0);
this.stats.put(NB_HUNTERS, 0);
this.stats.put(NB_SHADOWS, 0);
this.stats.put(NB_NEUTRES, 0);
this.stats.put(NB_MORTS, 0);
this.stats.put(NB_MORTS_NEUTRAL, 0);
this.stats.put(NB_MORTS_HUNTER, 0);
this.stats.put(NB_MORTS_SHADOW, 0);
this.stats.put(PARTIE_FINIE, 0);
}
@ -95,10 +96,15 @@ public class Plateau {
return this.joueurs;
}
public void setStat(String key, int valeur) {
this.stats.put(key, valeur);
}
public int getStat(String key) {
if(this.stats.containsKey(key))
{
return this.getStat(key);
return this.stats.get(key);
}else {
//TODO Exception