is , the cell gets the secondary color (e.g., White or false ).
The beauty of the fixed code lies in its use of the for loop. By nesting a column loop inside a row loop, the program efficiently visits every coordinate on the grid. This structure teaches students how computers handle two-dimensional space: not as a continuous canvas, but as a matrix of discrete points defined by x and y coordinates.
🚀 **CodeHS 9.1.6 Checkerboard v1: FIXED & WORKING!** 🚀
Key line: if (row + col) % 2 == 0 — this creates the perfect alternating pattern.
This public link is valid for 7 days and shares a thread, including any personal information you added. This link or copies made by others cannot be deleted. If you share with third parties, their policies apply. Can’t copy the link right now. Try again later. 916 checkerboard v1 codehs fixed
Place a 1 (or your secondary color). Let's look at how this applies to a 3x3 grid: Cell (0,0) →right arrow 0 + 0 = 0 (Even) →right arrow 0 Cell (0,1) →right arrow 0 + 1 = 1 (Odd) →right arrow 1 Cell (0,2) →right arrow 0 + 2 = 2 (Even) →right arrow 0 Cell (1,0) →right arrow 1 + 0 = 1 (Odd) →right arrow 1 Cell (1,1) →right arrow 1 + 1 = 2 (Even) →right arrow 0
Need help with another CodeHS exercise? Check out our guides for 9.1.7, 9.2.3, or 10.3.5 — all with verified fixes.
Before we dive into the solution, let's break down the requirements of the challenge:
: Missing or incorrect boundary checks in movement functions. is , the cell gets the secondary color (e
Do you need to modify this code to use instead of integers?
# Row Counter row_count = 8
CodeHS 9.1.6 Checkerboard v1: FIXED & WORKING! Struggling with the logic for the Checkerboard problem in Python? I finally got the
This produces an 8x8 pattern of X's and O's, where X's represent black squares and O's represent white squares. This link or copies made by others cannot be deleted
function start() // Define the size of your checkerboard grid var ROWS = 8; var COLS = 8; // Outer loop controls the rows for (var r = 0; r < ROWS; r++) // Inner loop controls the columns for (var c = 0; c < COLS; c++) // Check if the sum of row and column is even if ((r + c) % 2 === 0) drawSquare(r, c, Color.black); else drawSquare(r, c, Color.white); // Helper function to handle the drawing mathematics function drawSquare(row, col, color) var sideLength = 40; // Adjust based on your specific CodeHS canvas size var x = col * sideLength; var y = row * sideLength; var square = new Rectangle(sideLength, sideLength); square.setPosition(x, y); square.setColor(color); add(square); Use code with caution. CodeHS 9.1.6 Checkerboard v1: Java (2D Array) Fix
If this guide helped you, consider reviewing the logic of turning and row navigation to further solidify your JavaScript skills.
Ensure you loop rows 0–7 and columns 0–7.