# File: checkers.py # Author: Dr. Gibson # Date: 3/8/2018 # Section: N/A # E-mail: k.gibson@umbc.edu # Description: # Generate a 2-dimensional list for checkers BLACK = "." RED = "O" BOARD_SIZE = 8 def main(): ###################### # CREATING THE BOARD # ###################### # start off with an empty board board = [] # for each row we want to create for i in range(BOARD_SIZE): row = [] start = i # odd rows start with BLACK, even starts with RED # for each column in that row for j in range(BOARD_SIZE): if start % 2 == 0: row.append(RED) else: row.append(BLACK) # increment start to do the next square in the row start += 1 board.append(row) ########################## # PRINTING OFF THE BOARD # ########################## for i in range(len(board)): for j in range(len(board[i])): print(board[i][j], end = " ") print() # end the printed row with newline main()