<prompt> Kujenga kompyuta algorithm ambayo inaweza kucheza tic-tac-toe.  <response>: Heres a simple algorithm written in Python that can play Tic-Tac-Toe:import random Define the 3x3 board as a list of nested lists, initially emptyboard -, -, -, -, -, -, -, -, - Define the two characters or playersplayer1 Xplayer2 O Function to print the current boarddef print_boardboard: for row in board: print .joinrow Function to check if there is a winnerdef check_winboard: Check the rows for row in board: if row0 row1 row2 and row0 ! -: return row0 Check the columns for i in range3: if board0i board1i board2i and board0i ! -: return board0i Check the diagonals if board00 board11 board22 and board00 ! -: return board00 if board02 board11 board20 and board02 ! -: return board02 If no winner, return None return None Function to make a move for the AIdef ai_make_moveboard, ai_char, opponent_char: First check if the AI can win in the next move for i in range3: for j in range3: if boardij -: boardij ai_char if check_winboard ai_char: return else: boardij - If no winning move, check if the opponent can win in the next move and try to block it for i in range3: for j in range3: if boardij -: boardij opponent_char if check_winboard opponent_char: boardij ai_char return else 