# Define the chess board as a 2D array of characters
board = [
'R', 'N', 'B', 'Q', 'K', 'B', 'N', 'R',
'P', 'P', 'P', 'P', 'P', 'P', 'P', 'P',
'r', 'n', 'b', 'q', 'k', 'b', 'n', 'r',
'p', 'p', 'p', 'p', 'p', 'p', 'p', 'p',
' ' for _ in range(8) for _ in range(8)
]
# Define the chess piece symbols
pieces = {
'P': 'P',
'R': 'R',
'N': 'N',
'B': 'B',
'Q': 'Q',
'K': 'K',
'p': 'p',
'r': 'r',
'n': 'n',
'b': 'b',
'q': 'q',
'k': 'k'
}
# Define a function to display the board
def display_board(board, pieces):
# Iterate over the rows and columns of the board
for row in range(8):
for col in range(8):
# Get the piece at the current position
piece = board[row][col]
# If the piece is empty, draw a space
if piece == ' ':
print(' ', end='')
# If the piece is a queen, draw the queen's symbol
elif piece in pieces:
print(pieces[piece], end='')
# Otherwise, draw the standard piece symbol
else:
print(pieces[piece[0]], end='')
# Draw a newline after each row
print()
# Call the display_board function
display_board(board, pieces)