Question: # Check for win for row in range(1, N_ROWS + 1): for col in range(1, N_COLUMNS + 1): # Check horizontal win if col
# Check for win for row in range(1, N_ROWS + 1): for col in range(1, N_COLUMNS + 1): # Check horizontal win if col <= N_COLUMNS - 3 and \ game_board[str_index(row, col, N_COLUMNS)] == current_player and \ game_board[str_index(row, col + 1, N_COLUMNS)] == current_player and \ game_board[str_index(row, col + 2, N_COLUMNS)] == current_player and \ game_board[str_index(row, col + 3, N_COLUMNS)] == current_player: game_over = True # Check vertical win if row <= N_ROWS - 3 and \ game_board[str_index(row, col, N_COLUMNS)] == current_player and \ game_board[str_index(row + 1, col, N_COLUMNS)] == current_player and \ game_board[str_index(row + 2, col, N_COLUMNS)] == current_player and \ game_board[str_index(row + 3, col, N_COLUMNS)] == current_player: game_over = True if_gameover: print('{current_player} has won the game!') if 'current_player' == RED_SQUARE: current_player = YELLOW_SQUARE else: current_player = RED_SQUARE display_game_board(game_board) Print ('The game is over!') why is this error budhaghi
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
