Compile:
g++ game.cpp -o game
Run to play human vs human:
./game
Run to play human for X vs AI for O:
AI=O ./game
Run to play AI for X vs human for O:
AI=X ./game
And yes, you can make it play with itself:
AI=XO ./game
Also, define DEBUG environment variable to see some stats