private static Set<Position> positionsInDiagonalLines(Position from, int boardSize) {
        Set<Position> positions = new HashSet<Position>();
        int x = from.getX();
        int y = from.getY();
        while(++x < boardSize && ++y < boardSize) {
            positions.add(Position.valueOf(x, y));
        }
        // down left
        x = from.getX();
        y = from.getY();
        while(--x >= 0 && ++y < boardSize) {
            positions.add(Position.valueOf(x, y));
        }
        // up left
        x = from.getX();
        y = from.getY();
        while(--x >= 0 && --y >= 0) {
            positions.add(Position.valueOf(x, y));
        }
        // up right
        x = from.getX();
        y = from.getY();
        while(++x < boardSize && --y >= 0) {
            positions.add(Position.valueOf(x, y));
        }
        return positions;
    }