Fixed: 916 Checkerboard V1 Codehs

version passing all test cases! The key was properly nesting the loops and using the modulo operator to toggle the colors based on the row and column index. What was fixed: Corrected the row/column offset logic. Ensured the pen colors switch perfectly every other square. Fixed the positioning so the board starts exactly at the corner. The Logic: (row + col) % 2 == 0

At first glance, a checkerboard appears trivial. It is simply a grid of alternating red and black squares. A student’s first instinct is often to "hard code" the solution: draw a red square, then a black square, then a red square, and manually position them one by one. However, the "916" specification usually implies a large grid (likely 8x8 or similar dimensions), making hard-coding impractical and tedious. The "fixed" solution abandons the manual approach in favor of automation, using nested loops to traverse the rows and columns. 916 checkerboard v1 codehs fixed

public void run() for (int row = 0; row < ROWS; row++) for (int col = 0; col < COLUMNS; col++) int x = col * SQUARE_SIZE; int y = row * SQUARE_SIZE; version passing all test cases

Using the same variable (like i ) for both loops. This causes the loops to crash into each other. Ensured the pen colors switch perfectly every other square

Finally, pass your completed grid to the provided print_board function to display the result.