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

2 years ago
2 years ago
2 years ago
2 years ago
  1. import java.util.ArrayList;
  2. import java.util.Iterator;
  3. public class Game {
  4. Gameboard gb;
  5. ArrayList<Player> players;
  6. public static void main(String[] args) {
  7. Game g = new Game();
  8. while(true){
  9. for (Player p : g.players) {
  10. int c = 0;
  11. int dice;
  12. do {
  13. dice = p.rollDice();
  14. c++;
  15. if(p.checkFigureInBase(p.figures) == 4 && dice == 6) {
  16. //choose
  17. //moveToStart
  18. } else {
  19. //choose
  20. //moveToDice
  21. }
  22. } while (g.checkDice(dice, p, c));
  23. p.checkGameWin(p.figures);
  24. }
  25. }
  26. }
  27. public Game() {
  28. this.gb = new Gameboard();
  29. gb.initGameboard();
  30. players = new ArrayList<>();
  31. players.add(new Player("Rot", 40, 43));
  32. players.add(new Player("Blau", 44, 47));
  33. players.add(new Player("Gelb", 48, 51));
  34. players.add(new Player("Grün", 52, 55));
  35. }
  36. public boolean checkDice(int dice, Player p, int countRolls) {
  37. int figuresInBase = p.checkFigureInBase(p.figures);
  38. if(figuresInBase == 4) {
  39. return countRolls <= 3;
  40. } else return dice == 6;
  41. }
  42. }