import java.util.Random; public class Player { private int index; private String token; private boolean ki; private final Random move = new Random(); public Player(int index, String token, boolean ki) { this.index = index; this.token = token; this.ki = ki; } public int getIndex() { return index; } public String getToken() { return token; } public boolean hasKi() { return ki; } public int getTurn(ConsoleReader cr, PlayField field) { int columns = field.getColumns(); String s = "Where do you want to set your meeple? (1-" + columns + ")"; while(true) { System.out.println(s); int column = cr.readInt(s) - 1; if(column >= 0 && column < columns && field.hasFreeRow(column)) { return column; } } } public int getKiTurn(PlayField field) { int column; do { column = move.nextInt(field.getColumns()); } while(!field.hasFreeRow(column)); return column; } }