9.1.7 Checkerboard V2 Codehs __exclusive__ < 2024 >

This problem is a classic introduction to Nested Loops and Modular Arithmetic. It asks you to draw a checkerboard pattern where the color of each square depends on its position (row and column).

  • Compute the x and y pixel coordinates based on square size: console.log(line);
    1. Loop rows from 0 to 7.
    2. Loop columns from 0 to 7.
    3. If (row + col) % 2 == 0 → Color A, else Color B.

    Step-by-Step Solution Plan

    Let’s assume the following constants (typical in CodeHS): 9.1.7 Checkerboard V2 Codehs

    Pro Tip: Run your code with a board size of 4x4 first to verify the pattern before scaling to 8x8. This problem is a classic introduction to Nested

    @.@.@
    .@.@.
    @.@.@
    .@.@.
    @.@.@