Watch Fun Programming [video 34]
Here’s Mr. Fun’s Program:
size(400,400);
noStroke();
background(23,100,240);
float x = 0;
while (x < width)
{
float y = 0;
while (y < height)
{
fill(random(255));
rect(x,y,38,38);
y = y + 40;
}
x = x + 40;
}
Change the program so that the color depends on the position like this (red increses with x value, blue increases with y value):
Change the program so that there are 20 x 40 rectangles:
Show a mentor, mark the board and claim a prize