Get StartedForgetting that radius is half of the diameter . If your circles are 40 pixels wide, you need to move 40 pixels to reach the next center point.
This is the mathematical trick to the checkerboard pattern. 916 checkerboard v1 codehs fixed
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; Forgetting that radius is half of the diameter
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); function start() var squareSize = 50; var numRows
add(square);
: Iterating through the grid to modify specific elements.