The secret to a checkerboard is simple math. To determine if a cell should be "colored" or "empty," you look at its row and column indices:
Ensure your loops run while row < numRows , not <= , or you’ll hit an IndexOutOfBounds error.
Here is a standard way to write the program:
Ensure you are using the correct color constants (e.g., Color.BLACK vs Color.black ) depending on your specific CodeHS library version.
If the of the row and column is odd , it gets the other color.