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