xxxxxxxxxx
35
const start = 0;
const end = 99999999;
const code = 99999909;
let timePassed;
function setup() {
createCanvas(400, 400);
background(0);
stroke(255);
fill(255);
timePassed = millis();
textAlign(CENTER);
}
function draw() {
console.log(timePassed)
for (let i = start; i <= end; i++) {
// Convert the number to a string and pad it with leading zeros
const paddedNumber = String(i).padStart(end.length, "0");
if (paddedNumber === `${code}`) {
text(`Found Code: ${paddedNumber}`, width / 2, height / 2 - 50);
text(
`I took ${round(timePassed/1000, 4)} seconds to find the code`,
width / 2,
height / 2 + 50
);
}
}
noLoop();
}