Need help for a grid

Hi, my english is not that good i hope you understand. So I have a grid with a for cycle and wanted it to map the brightness of an ellipse, but don’t really know how to code it.

int a = 20;

void setup () {
size(800, 800);
ellipse(a,a,a20,a20);
}

void draw() {
background(255);
// ellipse(a,a,a20,a20);
fill(0);
noStroke();

float tiles = mouseX/3;
float tileSize = width/tiles;

translate(tileSize/2, tileSize/2);

for (int x = 0; x < tiles; x++) {
for (int y = 0; y < tiles; y++) {

   float size = map(brightness(a), 0, 255, tileSize, 0);

  ellipse(x*tileSize, y*tileSize, size, size);
  
 
}

}
}

Hello,

There are resources (tutorials, references, examples) here:
processing.org

Please format your code as a courtesy to the community:
https://discourse.processing.org/faq#format-your-code

:)