|
|
@ -11,17 +11,18 @@ public class Game { |
|
|
|
public static void main(String[] args) throws InterruptedException { |
|
|
|
Game g = new Game(); |
|
|
|
Player winner; |
|
|
|
clearScreen(); |
|
|
|
while(true){ |
|
|
|
for (Player p : g.players) { |
|
|
|
int c = 0; |
|
|
|
int dice; |
|
|
|
System.out.println(g.printGameboard(g, p)); |
|
|
|
do { |
|
|
|
clearScreen(); |
|
|
|
int figId; |
|
|
|
dice = p.rollDice(); |
|
|
|
TimeUnit.SECONDS.sleep(1L); |
|
|
|
System.out.println("Würfel: " + dice); |
|
|
|
System.out.println(g.printGameboard(g,p,dice)); |
|
|
|
TimeUnit.MILLISECONDS.sleep(600L); |
|
|
|
System.out.println("Würfel: "+ dice); |
|
|
|
TimeUnit.MILLISECONDS.sleep(600L); |
|
|
|
c++; |
|
|
|
ArrayList<Integer> usableFigures = g.getUsableFigures(dice, p, g); |
|
|
|
if(usableFigures.size() > 0) { |
|
|
@ -30,7 +31,7 @@ public class Game { |
|
|
|
} while(figId == -1); |
|
|
|
g.setFigure(figId, dice, p, g); |
|
|
|
clearScreen(); |
|
|
|
System.out.println(g.printGameboard(g, p)); |
|
|
|
System.out.println(g.printGameboard(g,p,dice)); |
|
|
|
} |
|
|
|
} while (g.checkDice(dice, p, c, g)); |
|
|
|
if(p.checkGameWin(p.figures)) { |
|
|
@ -38,8 +39,6 @@ public class Game { |
|
|
|
System.out.println("Spieler " + winner.name + " gewinnt!"); |
|
|
|
exit(42); |
|
|
|
} |
|
|
|
TimeUnit.SECONDS.sleep(1L); |
|
|
|
clearScreen(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -54,8 +53,8 @@ public class Game { |
|
|
|
players.add(new Player("Grün",30, 52, 29)); |
|
|
|
} |
|
|
|
|
|
|
|
public String printGameboard(Game g, Player p) { |
|
|
|
return gb.printBoard(g, p); |
|
|
|
public String printGameboard(Game g, Player p, int dice) { |
|
|
|
return gb.printBoard(g, p, dice); |
|
|
|
} |
|
|
|
|
|
|
|
public static void clearScreen() { |
|
|
|