xxxxxxxxxx
// For #genuary2025, day 10: "you can only use TAU in your code".
let zero, one, two, three, four, five, six, seven, eight, nine;
let row, count, x, y;
let taustr;
function preload() {
taustr = loadStrings('https://raw.githubusercontent.com/ivanrudnicki321/media/refs/heads/main/tau.txt');
}
function setup() {
zero = TAU - TAU;
one = TAU / TAU;
two = one + one;
three = two + one;
four = two * two;
five = four + one;
six = three * two;
seven = four + three;
eight = two * four;
nine = five + four;
ten = five + five;
count = zero;
row = zero;
createCanvas(windowHeight * (one + one / ten), windowHeight);
background('white');
x = height / (ten + ten);
y = zero;
}
function draw() {
textSize(height / (nine + nine + nine));
textAlign(LEFT, TOP);
textFont('monospace');
let dig = taustr[row].substring(count, count + one);
let d = dist(x + height / (three * four * nine), y + height / (three * four * nine), width / two, height / two);
if (d <= height / (two + (one / two)) && d >= height / three) fill("orange");
else fill(zero);
text(dig, x, y);
count += one;
x += height / (six * nine);
if (row == zero && count == two) {
x = height / (ten + ten);
y += height / (seven * four);
count = zero;
row += one;
} else if (count > nine * six) {
x = height / (ten + ten);
y += height / (seven * four);
count = zero;
row += one;
}
if (row == (seven * four - one)) noLoop();
}