Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 294
  • Last Modified:

play the computer in Tic Tac Toe

Player vs the computer. The trick is the computer is on the defense and I need to create a program that checks winner evertime it runs through each move. I have created the board and it can be played with two players but I am stuck. Please help.
0
alxnder
Asked:
alxnder
1 Solution
 
gj62Commented:
Sounds like homework.

We can't just give you the answer if it is homework - take your best shot, post your source, and indicate where you are stuck...
0
 
alxnderAuthor Commented:
I got it to check winner but how do I make the computer play?
0
 
gj62Commented:
Smartly?

If first, always go in center.  
If not, go in center if open.  
If not, go in diagonal... etc.

Always check for a block, or try to make 2 in a row - that's off the top of my head - it really shouldn't be that hard - you can map all unique permutations quite quickly...
0
 
MrNedCommented:
For general purpose turn based game playing like this, search for min-max algorithm. Used for eg in games like chess, checkers, othello and can certainly be used very simply in tictactoe.
0
 
jmcgOwnerCommented:
Nothing has happened on this question in more than 10 months. It's time for cleanup!

My recommendation, which I will post in the Cleanup topic area, is to
accept answer by gj62 [grade B] (homework).

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now