Processing sketch crashing website

时间:2018-05-28 18:44:32

标签: java google-chrome crash processing hang

Made a new sketch on openprocessing.org to test for some different grade combinations quickly... but whenever I run it, the page freezes hangs until chrome says that it is unresponsive. My other sketches are working just fine, it is only this one.

Here is the sketch:

double a, o, u, k;
int[][] combos;
int[][] a_combos, b_combos;
int failcounter;

void setup() {
    size(100,100);
    background(100);
    noLoop();
    a = 2 + 4;
    o = 4 + 4;
    u = 3 + 4;
    k = 3 + 5;

    combos = new int[10000][4];
    a_combos = new int[10000][4];
    b_combos = new int[10000][4];
    failcounter = 0;
}

void draw() {
    fillCombos();
    for (int i = 0; i < combos.length; i++) {
        double atemp = a + combos[0];
        double otemp = o + combos[1];
        double utemp = u + combos[2];
        double ktemp = k + combos[3];
        double avg = (atemp + otemp + utemp + ktemp) / 4;

        if (avg >= 17) {
            a_combos[i] = combos[i];
        } else if (avg >= 13.48) {
            b_combos[i] = combos[i];
        } else {
            failcounter++;
        }
    }

    println("Getting an A:");
    for (int i = 0; i < a_combos.length; i++) {
        if (a_combos[i] != null) println(a_combos[i]);
    }
    println("Getting a B:");
    for (int i = 0; i < b_combos.length; i++) {
        if (b_combos[i] != null) println(b_combos[i]);
    }
    println("A or B versus C, D, or F:");
    println(10000 - failcount + ", " + failcount);
}

void fillCombos() {
    int q = 0;
    int w = 0;
    int e = 0;
    int r = 0;

    for (int i = 0; i < combos.length; i++) {
        combos[i][0] = q;
        combos[i][1] = w;
        combos[i][2] = e;
        combos[i][3] = r;

        r++;
        if (r == 10) {
            r = 0;
            e++;
        }
        if (e == 10) {
            e = 0;
            w++;
        }
        if (w == 10) {
            w = 0;
            q++;
        }
    }
}

If I put print lines into several different locations in the code, none of them run for whatever reason. Any insight?

0 个答案:

没有答案