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.

50 lines
1.4 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) {
int figId = p.choose() - 1;
//checkIfKicked
p.figures.get(figId).setPosition(p.startPos);
} else {
int figId = p.choose() - 1;
//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",0, 40, 43));
players.add(new Player("Blau",10, 44, 47));
players.add(new Player("Gelb",20, 48, 51));
players.add(new Player("Grün",30, 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;
}
}