{"size": 618, "ext": "js", "max_stars_repo_path": "Ray Tracing in a Weekend/Ch1_Output_an_image.js", "max_stars_repo_name": "MultivacX/ReCoding", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Ray Tracing in a Weekend/Ch1_Output_an_image.js", "max_issues_repo_name": "MultivacX/ReCoding", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Ray Tracing in a Weekend/Ch1_Output_an_image.js", "max_forks_repo_name": "MultivacX/ReCoding", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 26.8695652174, "max_line_length": 51, "alphanum_fraction": 0.4433656958}
const fs = require('fs');
const path = require('path');
console.log(__dirname);

function main() {
    const nx = 200;
    const ny = 100;
    let img = `P3\n${nx} ${ny}\n255\n`;
    for (let j = ny - 1; j >= 0; j--) {
        for (let i = 0; i < nx; i++) {
            const r = i * 1.0 / nx;
            const g = j * 1.0 / ny;
            const b = 0.2;
            const ir = Math.floor(255.99 * r);
            const ig = Math.floor(255.99 * g);
            const ib = Math.floor(255.99 * b);
            img += `${ir} ${ig} ${ib}\n`;
        }
    }
    fs.writeFileSync(`${__dirname}/w1_0.ppm`, img);
}

main();