# Arup Guha
# 9/22/2020
# Checkerboard Program with filled squares.

import turtle

# Important constants.
SQUARE_SIZE = 50
SQUARES_PER_SIDE = 8

# Beginning position.
initX = -(SQUARES_PER_SIDE//2)*SQUARE_SIZE
initY = initX

# Keep track of the row number.
row = 0

# What we'll fill half the squares with.
turtle.fillcolor("black")

# Moves in x (from left to right)
for x in range(initX, initX + SQUARE_SIZE*SQUARES_PER_SIDE, SQUARE_SIZE):

    # This keeps track of the column number.
    col = 0

    # Moves in y (from bottom to top)
    for y in range(initY, initY + SQUARE_SIZE*SQUARES_PER_SIDE, SQUARE_SIZE):

        # Move turtle to bottom left of this square.
        turtle.penup()
        turtle.setpos(x, y)
        turtle.pendown()

        # On the even parity squares we begin the fill.
        if (row+col)%2 == 0:
            turtle.begin_fill()

        # Draw one square.
        for i in range(4):
            turtle.forward(SQUARE_SIZE)
            turtle.left(90)

        # Same deal - must end the fill.
        if (row+col)%2 == 0:
            turtle.end_fill()

        # Update column number.
        col = col + 1

    # Update row number.
    row = row + 1
