function start() var squareSize = 50; var numRows = 8; var numCols = 8; for (var row = 0; row < numRows; row++) for (var col = 0; col < numCols; col++) var x = col * squareSize; var y = row * squareSize;

var SQUARE_SIZE = 50; for(var row = 0; row < 8; row++) for(var col = 0; col < 8; col++) var x = col * SQUARE_SIZE; var y = row * SQUARE_SIZE; var color = (row + col) % 2 === 0 ? "red" : "black"; var rect = new Rectangle(SQUARE_SIZE, SQUARE_SIZE); rect.setPosition(x, y); rect.setColor(color); add(rect);

def draw_square(color): turtle.color(color) turtle.begin_fill() for _ in range(4): turtle.forward(50) turtle.left(90) turtle.end_fill() turtle.forward(50)

If you see white lines between your squares, ensure you are calculating SQUARE_SIZE using getWidth() / 8 . If you hardcode a number like 50 on a canvas that isn't exactly 400 , the grid won't fit perfectly. 2. Rectangles Overlapping the Border

Filmų TV Programa pagal Kanalus