INNER CODE UNIT · JavaScript

x

ren-yuan/c2.js · examples for p5.js/Chromosome1.js:50

    let x = width / 2 + 20;
    let y = 20;
    for (let i = 0; i < p.chromosomes.length; i++) {
        let string = p.chromosomes[i].toString(true);
        text(string, x, y);
        y += 20;
        if (y > height - 20) {
            x += 80;
            y = 20;
        }
    }

    let tx = 20;
    let ty = 20;
    fill('#333333'); 
    text('generation ' + info.generation, tx, ty);
    text('best fitness ' + info.bestFitness.toFixed(2), tx, ty+15);
    text('worst fitness ' + info.worstFitness.toFixed(2), tx, ty+30);

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…