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.
# Create the square at the correct position square = Rectangle(SQUARE_SIZE, SQUARE_SIZE) square.set_position(col * SQUARE_SIZE, row * SQUARE_SIZE)
If you are a CodeHS teacher, you have access to excellent resources to help your students succeed.
If the of the row and column (row + col) is even , it gets one color. 9.1.6 checkerboard v1 codehs
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 ).
Students new to coding can sometimes get stuck on this exercise. Here are the most common mistakes and how to fix them:
Here is a standard way to write the program: This public link is valid for 7 days
If the canvas width and height are known, the width and height of an individual square can be calculated dynamically:
Alternatively, you can think of it as: if the row is even, start with color A; if the row is odd, start with color B. The Code Implementation (Java/CodeHS Style)
In CodeHS V1, you are often working with a Grid object. Remember that grid.set(row, col, value) is the standard syntax. If your specific assignment uses or Graphics , you would replace grid.set with putBall() or new Rect() , but the nested loop logic remains identical. Common Pitfalls Can’t copy the link right now
Text (console) output — using characters:
// Go to next row if (leftIsClear()) turnLeft(); move(); turnLeft(); row++; else break;