How can i do this?

Hi,
Im new to processing and i have a question. I need to do this image, circles on x and y axis where there is an increase of circles as shown in the image. This is what i have so far:
20

int x;
int y;
int max,may;


size(600,600);
background(155);

may = height/10;
max = width/10;
x = max/2;
y= may/2;

for( y= may/2; y<height; y=y+may)
{
  for( x = max/2; x<width; x=x+max)
  {
  noStroke();
  fill(200,0,0);
  ellipse(x,y,max,may);
  }
  
}

Hi @Cuchis, what is failing in the code? Do you see any errors? Does it display anything?
Are you using the setup() and draw() functions?

your attempt is to go down line by line

So the outer for loop is the line, the inner for loop the columns of the grid

But you need to check the upper boundary of the inner for loop which is now width.

Instead use a variable upperBoundX that you increase every line by max

1 Like