Auf Thema antworten

Wieso denn nicht einfach so...

[code=java]    public static void plotFunction(int w, int h, IntBinaryOperator function) {

        for (int y = 0; y < h; y++) {

            for (int x = 0; x < w; x++) {

                System.out.print((char) function.applyAsInt(x, y));

            }

            System.out.println();

        }

    }


    public static void main(String[] args) {

        final int höhe = 5;

        final int breite = 8;

        plotFunction(breite, höhe, (x, y) -> y % 2 == 0 ? '.' : '*');

    }[/code]

?



Oben