ADD method checkScoreToPlay to Rules | UPDATE LaticeApplicationConsole

master
Mathis 2022-05-31 15:06:48 +02:00
parent a5c0bd9b5d
commit 9dba3ed659
2 changed files with 12 additions and 4 deletions

View File

@ -142,9 +142,9 @@ public class LaticeApplicationConsole {
int choiceMenu = Integer.parseInt(play.next()); int choiceMenu = Integer.parseInt(play.next());
switch(choiceMenu) { switch(choiceMenu) {
case 1: //if (arbitre.checkScore(freeTile)){ case 1: if (arbitre.checkScoreToPlay(player, freeTile) == false){
//System.out.println("Vous n'avez pas assez de points pour jouer un nouvelle tuile"); System.out.println("Il vous faut 2 points pour jouer un nouvelle tuile !!!");
//}else { }else {
Boolean rulesCheck = false; Boolean rulesCheck = false;
while (rulesCheck == false) { while (rulesCheck == false) {
@ -162,7 +162,7 @@ public class LaticeApplicationConsole {
player.getRack().removeTile(tile); player.getRack().removeTile(tile);
board.displayGameBoard(); board.displayGameBoard();
//} }
break; break;

View File

@ -74,6 +74,14 @@ public class Rules {
return sun; return sun;
} }
public Boolean checkScoreToPlay(Player player, Boolean free) {
if (player.getScore() < 2 && free == false) {
return false;
}else {
return true;
}
}
public Boolean arbitration(Player player, GameBoard board, Tile tile, Boolean start) { public Boolean arbitration(Player player, GameBoard board, Tile tile, Boolean start) {
if (start == true){ if (start == true){