Programming challenge: AI player for tic-tac-toe (must not lose)