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 algorithm for playing tic tac toe in python.
user
the algorithm should first create a 3-by-3 tic-tac-toe board. then it should check the board for a winning move. if a player has the opportunity to make a winning move, the algorithm should take that move. otherwise, it should examine the board to block the opponent from making a winning move. finally, if no winning moves or blocks can be made, the algorithm should randomly select an available spot as the next move.
assistant