View Single Post
Old March 21st, 2003, 04:12 AM     #8 (permalink)
Fractile81
Member
 
Join Date: Mar 2002
Location: BYU - Provo
Posts: 43
Send a message via AIM to Fractile81 Send a message via Yahoo to Fractile81
I think it was stated before, but something as to this sort:

Computer First:
1) Perhaps randomly choose a place (might be more fair)

2) Let player make a move ( jump to here if the player plays first)

3a) Check if the computer can win, and place accordingly
3b) If not, check if the player might win their next move (really hairy way would be to check all rows, cols, and then the two diags just to make sure, using a for-loop or the like... again, hairy ), and block if needed
3c) Last resort: try to build off of previous moves, weighting moves by their ability to block the player from making a complete line

4) Jump back to step 2

This is a more dynamic algorithm than you would ever really need. It could probably just be replaced by a lot of if-statements. So, I guess that becomes your question: you want a static AI ( lots of if's) that is very "narrow-minded" or a dynamic AI ( the hairy part above) which, while still predictable, will act "intelligently"?

I know I'm stating the obvious, but it's certainly the first approach I'd take... plus, now you have a bare-bones algorithm
__________________
-Fractile81
Fractile81 is offline   Reply With Quote