Mathober 2026 ยท day 2, Zebra Graph
Zebra Graph
let pondRoot = 8
function setup() {
theSizeThatFits = min(windowWidth, windowHeight)*0.9
theCanvasThatIsFilled=createCanvas(theSizeThatFits, theSizeThatFits);
background(20,70,80);
strokeWeight(0.25);
pondSize=width/pondRoot
ponds()
describe("a chessboard with 2x3 hops from random squares drawn as white lines, but one of the chessboard colors is drawn transparently over every frame created a checkered filter on a zebra graph")
stroke(255)
}
function draw() {
ponds()
row = random([1,2,3,4,5,6,7,8])
col = random([1,2,3,4,5,6,7,8])
rowHop = random([-3,-2,2,-3])
if(abs(rowHop) === 3){
colHop = random([-2,2])
}else{
colHop = random([-3,3])
}
hopPosRow =(rowHop+row)*pondSize - pondSize/2
hopPosCol =(colHop+col)*pondSize - pondSize/2
rowPos =row*pondSize - pondSize/2
colPos = col*pondSize - pondSize/2
if(hopPosRow>0&&hopPosRow<width&&hopPosCol>0&&hopPosCol<height){
line(rowPos,colPos,hopPosRow,hopPosCol)
}
}
function ponds(){
push()
noStroke()
for(let i = 0;i<pondRoot;i++){
for(let j =0;j<pondRoot;j++){
if(i%2===0&&j%2===0){
fill(50,100,120,10)
rect(i*pondSize,j*pondSize,pondSize)
}else if(i%2===1&&j%2===1){
fill(50,100,120,10)
rect(i*pondSize,j*pondSize,pondSize)
}
}
}
pop()
}
function keyPressed(){
if(keyCode===83){
save(theCanvasThatIsFilled,"Zebra","png")
}
}