How are you getting it to block winning moves though?
The secret is on line 128. It checks whether there's a possible winner on the player side.
From the code it looks like the computer is just looking at the possible moves and making a random move from that list. Or do I have that completely wrong?
Yes, but it checks it always for both the computer and the player
Well, it seems that it's not unbeatable, but i think it's good enough.
I'll have to get mine console ready, I wrote it as an exercise in GLUT.