Browse Source

Refactor Method call

AIPlayer
FelixKrull 3 years ago
parent
commit
4139925d63
  1. 7
      src/main/java/Game.java

7
src/main/java/Game.java

@ -13,6 +13,7 @@ public class Game {
Player winner; Player winner;
while(true){ while(true){
for (Player p : g.players) { for (Player p : g.players) {
System.out.println(g.toString());
int c = 0; int c = 0;
int dice; int dice;
System.out.println("Spieler " + p.name + " an der Reihe."); System.out.println("Spieler " + p.name + " an der Reihe.");
@ -35,6 +36,7 @@ public class Game {
System.out.println("Spieler " + winner.name + " gewinnt!"); System.out.println("Spieler " + winner.name + " gewinnt!");
exit(42); exit(42);
} }
//clear;
} }
} }
} }
@ -49,6 +51,11 @@ public class Game {
players.add(new Player("Grün",30, 52, 29)); players.add(new Player("Grün",30, 52, 29));
} }
@Override
public String toString() {
return gb.toString();
}
public boolean checkDice(int dice, Player p, int countRolls) { public boolean checkDice(int dice, Player p, int countRolls) {
int figuresInBase = p.checkFigureInBase(p.figures); int figuresInBase = p.checkFigureInBase(p.figures);
if(figuresInBase == 4) { if(figuresInBase == 4) {

Loading…
Cancel
Save