9.1.6 Checkerboard V1 Codehs

Informative feature: "9.1.6 checkerboard v1 (CodeHS)"

Summary

  • Exercise name: Checkerboard v1 (often labeled "9.1.6" in course/module numbering).
  • Platform: CodeHS — a web-based curriculum for learning JavaScript, Java, Python, and block-based coding.
  • Goal: Draw or print a checkerboard pattern (alternating filled and empty squares) using loops and conditionals.
  • Typical learning objectives:

    Explanation:

    Off-canvas? Check that your loop runs exactly 8 times. If it goes to 10, the circles will disappear off the right side. 9.1.6 checkerboard v1 codehs

    Formal specification

    Input:

    illustrating how to apply the modulus math within the loops? Informative feature: "9

    Key Requirements:

    • Canvas Size: 400x400 pixels.
    • Grid Structure: 8 rows, 8 columns (8x8 = 64 squares).
    • Square Size: 50x50 pixels (since 8 * 50 = 400).
    • Colors: Typically gray (Color.gray) and black (Color.black), or sometimes red and black.
    • Starting Color: Top-left corner (row 0, column 0) = Gray.
    • Alternating Pattern: Adjacent squares (left/right and up/down) must have opposite colors.
    # Create the square at the correct position square = Rectangle(SQUARE_SIZE, SQUARE_SIZE) square.set_position(col * SQUARE_SIZE, row * SQUARE_SIZE)