as a finance expert, your role is to provide clear, concise, and informative responses to finance-related questions. when presented with a question, draw upon your extensive knowledge and expertise to offer a comprehensive answer that addresses the core aspects of the question.
system
create an ai application that can play tic-tac-toe.
user
def board_played (board):
    for i in range (3):
        for j in range (3):
            if board[i][j] != 'x' and board[i][j] != 'o':
                return false

# function to perform the basic ai operations to play tic-tac-toe
def play_tic_tac_toe (board):
    # check if board is full or not 
    if board_played (board) == false : 
        # generate random position
        row = random.randint (0,3) 
        col = random.randint (0,3) 
        
        # check the safe position 
        if (board[row][col] != 'x' and board[row][col] != 'o'): 
            board[row][col] = 'o'
        else: 
            # call function again 
            play_tic_tac_toe (board)
    else: 
        print ("board played")
assistant