fractalkitty looking for math? fractalkitty.com

Mathober 2026 ยท day 11, Problem of Points

Problem of Points

#random#interactive#mathober

gameNdiv

let gameN = 0
let div = 2
function setup() {
	theSizeThatFits = min(windowWidth, windowHeight)*0.9
	theCanvasThatIsFilled=createCanvas(theSizeThatFits, theSizeThatFits);
	background(20,70,80);
	noStroke()

	describe("a split of light and dark rectangles in an abstract barcode like representation")
  p = width/20
}

function draw() {
	r1 = random([0,1]);
  r2 = random([0,1]);
  r3 = random([0,1]);
  p1 = r1+r2+r3;
  p2 = 3 - p1;
  console.log(p1,p2)
  fill(100,140,150)
  rect(div,gameN*div+div,p1*p,div)
  fill(180,240,250)
  rect(width - p2*p,gameN*div+div,p2*p,div)
  fill(10,50,60)
  rect(width/2-div/2, 0,div,width)
 if(p1===2){
   fill(100,140,150)
   rect(width/2 - 0.75*3*width/10,gameN*div+div, 3*width/10, div)
 }else if(p1 ===1){
   fill(180,240,250)
   rect(width/2 - 0.25*3*width/10,gameN*div+div, 3*width/10, div)
 }else if(p1 === 3){
   fill(100,140,150)
   rect(width/2 - 3*width/10,gameN*div+div, 3*width/10, div)
 }else{
   fill(180,240,250)
   rect(width/2 - 0*3*width/10,gameN*div+div, 3*width/10, div)
 }
 
  
  gameN++
  if (gameN*div>height){
    noLoop()
  }
  
}

function keyPressed(){
	if(keyCode===83){
		save(theCanvasThatIsFilled,"Problem_with_Points","png")
	}
}