Implementing a tic-tac-toe rival