9.1.7 Checkerboard V2 Answers
Simply copying the code might get you a checkmark, but CodeHS often includes a quiz or subsequent exercise that requires you to modify the pattern. Here’s how to adapt your solution for different scenarios:
Course Context: CodeHS Unit 9.1 typically covers "Strings" or "Methods" depending on the version, but in the AP CSA or Standard Java track, 9.1.7 is often a culminating exercise on using nested for loops and conditionals to create a visual pattern.
The Assignment: You are given a Checkerboard class that extends GraphicsProgram. Your task is to write a program that draws a standard 8x8 checkerboard pattern. The board should have: 9.1.7 checkerboard v2 answers
Why "v2"? The "v2" indicates this is the second version of the assignment, usually with stricter requirements regarding method structure, color constants, or resizing behavior.
Some versions of CodeHS use different color requirements: Simply copying the code might get you a
Q: Can I use a different number of rows and columns?
A: Yes, but the 9.1.7 autograder specifically expects 8x8. Changing it will fail the test.
Q: Why does my board start in the wrong corner?
A: Check your x and y calculations. x = col * size ensures the first column starts at 0. If you accidentally add an offset, correct it. Why "v2"
Q: How do I submit without getting a "missing main method" error?
A: The GraphicsProgram class has its own main method internally. You do not need to write public static void main. Just extend GraphicsProgram.
Q: I see a gray square instead of a red one. Is my code wrong?
A: No. Some versions of 9.1.7 use black and gray. If the sample image shows gray, replace Color.RED with Color.GRAY.
Q: The autograder says "Expected output: 8 rows of alternating squares" but I have it.
A: Ensure your canvas size is exactly 400x400 (since 8 * 50px = 400px). If you used getWidth(), the board might be off by a few pixels if the window isn't perfectly square.