9.1.6 Checkerboard V1 Codehs Better Site
). Floor division ( // ) automatically calculates that each SQUARE_SIZE must be 50 pixels.
The canvas is 400×400, but squares don't align perfectly. Fix: Calculate the window size dynamically from the square size and number of squares, as shown in the constants above. 9.1.6 checkerboard v1 codehs
Copy the code above, paste it into the CodeHS editor, and run it. You should see a perfect 8×8 checkerboard. If you run into issues, double-check your spelling of Color.GRAY (remember: American English spelling) and ensure you have imported acm.graphics.* and java.awt.* . Fix: Calculate the window size dynamically from the
# Loop through rows (vertical) for row in range(NUM_ROWS): # Loop through columns (horizontal) for col in range(NUM_COLS): If you run into issues, double-check your spelling of Color
CodeHS Introduction to Programming (JavaScript) Module: 9.1 - Karel Challenges Problem: 9.1.6 Checkerboard v1 Objective: Write a Karel program that places a checkerboard pattern of beepers on a rectangular world of any size (within Karel’s limits).
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 ).
The while(frontIsClear()) loop moves Karel twice (if possible) to skip a spot.