Log in
Open account

For further help with 2D lists, check out official resources like the CodeHS Python 3 Course Explore Page or community discussions on Reddit's r/codehs Checkerboard v2

# Determine the color based on the sum of row and col indices # If the sum is even, it's one color; if odd, it's the other. if (row + col) % 2 == 0: square.set_color(Color.black) else: square.set_color(Color.white)

rect.setColor(Color.WHITE);

The ultimate goal is a board that looks something like this:

if ((row + col) % 2 == 0) square.setFillColor(Color.RED); else square.setFillColor(Color.BLACK);

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.

After you've built a full row of 8 numbers, you append that row (as a list) to your main board list.

A loop that repeats the setup and move functions until the top of the world is reached. 3. The 9.1.6 Checkerboard V1 Code Solution

: Used to detect even and odd numbers to alternate colors. Coordinate Mapping : Calculating the precise pixel coordinates for drawing each square. Complete Solution Code