9.1.6 Checkerboard V1 Codehs !full! Jun 2026
By checking if (r + c) is divisible by 2 using the modulo operator ( % ), you can cleanly alternate colors. Step-by-Step Code Implementation
What are you currently seeing?
Ensure xPos uses the column variable ( c ) and yPos uses the row variable ( r ). Reversing them will flip your grid mapping logic. 9.1.6 checkerboard v1 codehs
Understanding the simple logic in v1—building rows and appending them to a list—is crucial for tackling those more complex patterns. Mastering this foundational exercise sets you up for success in the rest of the project. Good luck, and happy coding!
. Use a loop to populate it with 8 rows, each initially filled with zeros to establish the basic structure. 2. Target Specific Rows for Pieces By checking if (r + c) is divisible
def create_checkerboard(): # Create the main window win = Window() win.set_background("white")
: Create a 2D integer array with 8 rows and 8 columns. Reversing them will flip your grid mapping logic
s) and the bottom 5 rows contain a different pattern, or as often interpreted, the entire board is designed using a set of rules where specific indices are set to : (8 rows, 8 columns). Initial State : A list of lists filled with Goal : Use assignment statements to change specific Key Concept : Indexing 2D lists ( board[row][col] = 1 ).
grid of alternating colored squares (typically black and red, or black and white) that fills the canvas canvas perfectly. Key Technical Constraints : 8 rows and 8 columns (64 total squares).
The core concepts remain identical: nested loops for iterating over the 8x8 grid, a conditional to target specific rows, and the modulo operator to create the alternating pattern.