You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.3 KiB

import java.util.ArrayList;
import java.util.Iterator;
public class Game {
Gameboard gb;
ArrayList<Player> players;
public static void main(String[] args) {
Game g = new Game();
while(true){
for (Player p : g.players) {
int c = 0;
int dice;
do {
dice = p.rollDice();
c++;
if(p.checkFigureInBase(p.figures) == 4 && dice == 6) {
//choose
//moveToStart
} else {
//choose
//moveToDice
}
} while (g.checkDice(dice, p, c));
p.checkGameWin(p.figures);
}
}
}
public Game() {
this.gb = new Gameboard();
gb.initGameboard();
players = new ArrayList<>();
players.add(new Player("Rot", 40, 43));
players.add(new Player("Blau", 44, 47));
players.add(new Player("Gelb", 48, 51));
players.add(new Player("Grün", 52, 55));
}
public boolean checkDice(int dice, Player p, int countRolls) {
int figuresInBase = p.checkFigureInBase(p.figures);
if(figuresInBase == 4) {
return countRolls <= 3;
} else return dice == 6;
}
}