Sunday, July 12, 2009

How do I write a computer player for a tic tac toe game in C++?

Hi,





So in my computer class, we are supposed to write a tic tac toe game in C++. I have the program completly working. And for extra credit we are supposed to write a computer player, you can play against, but is unbeatable. I have a start, in so far, that it just puts random plays on the field(every game the same, and no strategy), but when the human gets two in a row, the computer blocks that!


I don't have any idea how to get the rest of it. i don't ask you to write the code for me(wouldnt complain, if you do though), but am hoping for a hint from someone, who has maybe even done that before or knows a lot about programming, since I just started less than a year ago.


for questions, suggestions, solutions, etc. I would be very thankful.





Max

How do I write a computer player for a tic tac toe game in C++?
Why not have two instances of your computer player play each other continually? Log each move so that if one player actually wins you can find the error and correct the logic.


No comments:

Post a Comment