Crayon Consulting logo

9.1.7 Checkerboard V2 Codehs -

Create a checkerboard pattern of squares in a graphics window using nested loops. Each square is the same size; squares alternate color (e.g., black and white). The pattern should form an N-by-N grid (commonly 8×8), and the top-left square’s color should follow the specification (typically black).

The "V2" autograder on CodeHS is stricter. It may check for: 9.1.7 Checkerboard V2 Codehs

Pro Tip: Run your code with a board size of 4x4 first to verify the pattern before scaling to 8x8. Create a checkerboard pattern of squares in a

Expected 4x4 pattern:
R B R B
B R B R
R B R B
B R B R

Bad Code:

for (let row = 1; row <= 8; row++) // Rows 1-8 instead of 0-7

Fix: In programming, grids almost always start at index 0. Use row < 8. Pro Tip: Run your code with a board