/** * <b>pre-condition</b>: The Token to exist in Board. Computes valid movement locations for the * token in board. * * @param board * @param tkn * @return */ public List<Vector2D> tokenSelection(Board board, Token tkn) { // List<Vector2D> moveLocations = new ArrayList<Vector2D>(); this.moveLocations = new ArrayList<Vector2D>(); // Determine if action is valid (is permitted): if (tkn instanceof MovablePlayerToken) { // Get available positions for movement/attack // based on token class: MovablePlayerToken mtkn = (MovablePlayerToken) tkn; // Special movement pattern for scouts, based on state of the board: if (mtkn instanceof Scout) { this.moveLocations = movementSystemScout(board, (Scout) mtkn); } else { // Get ABSOLUTE board locations: this.moveLocations = mtkn.getMovePattern(); // Vector2D pos = new Vector2D(mtkn.getRow(),mtkn.getCol()); // Check what locations are valid on the board: this.moveLocations = validInBoard(this.moveLocations); this.moveLocations = validInPlayer(board, this.moveLocations); } } // else return empty valid move locations: return this.moveLocations; }