Skip to content
U2010046
  • AI Chat
  • Code
  • Report
  • Task 1.

    Solving the Chess Knight's Shortest Path with Bi-Directional Search

    def create_chessboard(rows, cols):
        chessboard = []
        for row in range(rows):
            row_data = []
            for col in range(cols):
                # Alternating between dark and light squares
                if (row + col) % 2 == 0:
                    row_data.append('.')
                else:
                    row_data.append(' ')
            chessboard.append(row_data)
        return chessboard
    
    def display_chessboard(chessboard):
        for row in chessboard:
            print(" ".join(row))
    
    # Define the size of the chessboard
    rows = 13
    cols = 13
    
    # Create and display the empty chessboard
    chessboard = create_chessboard(rows, cols)
    display_chessboard(chessboard)