user
Tell me how would you respond to the following request.
Create an algorithm for playing tic tac toe in Python.

assistant
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.