Mathober2025_NumberFields
Rational Numbers & Based20
Updated
•2 min read
FieldofBase20
For my 19th sketch of Mathober2025 coded in P5js(remixed of a previous sketch), FieldofBase20 takes the 24th prompt of “Number Field” and makes a grid of base20 numbers which are part of the field of rational numbers.
Poetry
Numbers Field
Numbers Grid
Numbers wheel
Numbers Feel
Numbers Filled
Images




Code
P5js
function setup() {
createCanvas(windowWidth, windowHeight);
//PROMPT
x1 = prompt("choose a number between 0 and 159999");
x2 = prompt("choose another number between 0 and 159999");
x3 = prompt("choose a number larger than 159999 or smaller than 0");
x4 = prompt("choose another number between 8000 and 159999");
x5 = prompt("choose any number");
}
//Font
let usedFont = ["fantasy", "monospace", "georgia", "Courier New"];
//ARRAYS For Colors
let fillnumber = ["orange", "yellow", "gold", "red", "pink", "salmon", "coral"];
let fillnumber2 = [
"blue",
"teal",
"skyblue",
"navy",
"turquoise",
"royalblue",
"midnightblue",
];
function draw() {
// numbers in based 20 translation
let numbers = [
based_multi(x1, 20),
based_multi(x2, 20),
based_multi(x3, 20),
based_multi(x4, 20),
based_multi(x5, 20),
];
background("black");
textSize(35);
//Varied Framerate
frameRate(Math.cbrt((second() % 35) + 3));
//Nested for loops to get grid like factor
for (let i = 0; i < windowWidth; i = i + 125) {
for (let j = 0; j < windowHeight; j = j + 150) {
if (i % 15 > 7) {
textFont(random(usedFont));
stroke(random(fillnumber));
strokeWeight((second() % 30) + 5);
fill(random(fillnumber2));
text(random(numbers), i + random(35, 44), j + 10);
} else {
textFont(random(usedFont));
stroke(random(fillnumber2));
strokeWeight(random(second() % 30) + 5);
fill(random(fillnumber));
text(random(numbers), i + 10, j + random(27, 3) + (second() % 3));
}
}
}
}
// allow for fullscreen without switching
function mousePressed() {
if (
mouseX > 0 &&
mouseX < windowWidth &&
mouseY > 0 &&
mouseY < windowHeight
) {
let fs = fullscreen();
fullscreen(!fs);
}
}
//allows for translation into any base system
//takes an int I and translates it to a
function based_multi(i, b) {
return Math.abs(i).toString(b);
}




