import java.util.*; public class Player { String name; ArrayList
figures; int startPos; int startHome; int jumpToHome; Scanner scanner; public Player(String name, int startPos, int startHome, int jumpToHome) { this.name = name; this.startPos = startPos; this.startHome = startHome; this.jumpToHome = jumpToHome; figures = new ArrayList<>(); for(int i = 0; i < 4; i++) { figures.add(new Figure()); } } public int rollDice() { return (int) (Math.random() * 6 + 1); } public boolean checkGameWin(ArrayList
figures) { Iterator
it = figures.iterator(); Figure f; while(it.hasNext()) { f = it.next(); if(!(f.getPosition() >= startHome && f.getPosition() <= startHome+3)) { return false; } } return true; } public int checkFigureInBase(ArrayList
figures) { Iterator
it = figures.iterator(); Figure f; int count = 0; while(it.hasNext()) { f = it.next(); if(f.getPosition() == -1) { count++; } } return count; } public int choose(ArrayList usableFigures) { StringBuilder out = new StringBuilder("["); Iterator it = usableFigures.iterator(); for(int i = 0; i Collections.max(usableFigures) + 1 || input < Collections.min(usableFigures) + 1) { System.out.println("Die eingegebene Zahl war zu groß oder zu klein.\n" + "Bitte nur Zahlen von " + (Collections.min(usableFigures) + 1) + " bis " + (Collections.max(usableFigures) + 1) + " eingeben."); return -1; } return input - 1; } catch (Exception e) { System.out.println("Die Eingabe hat keine Zahl bekommen.\n" + "Bitte nur Zahlen von " + (Collections.min(usableFigures) + 1) + " bis " + (Collections.max(usableFigures) + 1)+ " eingeben."); return -1; } } }