Greetings.

I'm writing an MFC Go Moku game. If you don't know what that is (well for one thing, you probably can't help me), it is a board game on a 20x20 grid. It's a two player game: white vs black. The object is to get 5 in a row to win, and on your turn you can place a stone on any intersection in the grid.
To give you an idea of the game, it will have network playability, so players can have 3 options: single player against the cpu, two player local, or two player network. The single player and two player modes are already running great (of course, single player isn't any fun with a dumb computer).

Anyway, my predicament is the cpu AI. I can't quite wrap my mind around how to approach it. The way I'm set up now is generally to do this:
Code:
void CMainWnd::CpuMove() {
  //...
  int x, y;
  CpuDetermineBestMove(x, y);
  CpuDetermineOpponentBestMove(x, y);
  //...
}
The way I figure it, I want to determine the best coords for us to move then figure the best place our opponent can move (and if it will lead to a win) so we can block him if his best move is better than ours (meaning he wouldn't have to block our move). Of course this may not make sense the way I'm describing it, so if not, sorry.

Please assist if you can hold my hand and toss out some ideas as to how you would approach this problem. And of course processing time does matter, but I want to have a very intelligent computer, so I'm aiming for quality over speed (although I will have different settings of difficulty for the AI).

Thanks very much for any assistance you can offer.

I'm attaching the program in its current state for you to look at.