I am doing a Game project in C program in which a user can play the game with computer.In otherwords, first the user will enter the value and according to that the computer enter the value but i can't understand that how the computer will give the value.please suggest me some idea.Thanks.
But i don't know Artificial Intelligence.So is there any simple way to handle it and if it is there then please provide me some article or pdf etc.Thank you.
You can arrange all possible moves (independent of a single game) in a tree, the trunk being the game before the first move. Each node traversed represents one move. At the "leafs", the game is either a win, a loss or a draw for the computer side; since a win or loss can happen before all fields are filled, the tree is somewhat asymmetrical.
Obviously, not all possible moves are of equal quality, so the tree should be marked from bottom to top:
As soon as the computer side arrives at a move choice where one of the moves leads to a win, this is a "1 round sure win".
This can be propagated into a 2 round sure win:
If one move choice leads - regardless of the opponent's moves - always to a node of a one-round sure win, you have a two-round sure win. And so on.
Vice versa with a sure loss.
The main effort is properly calculating the tree. Then the CPU player just has to avoid moves (subtrees) which lead to a sure loss, take subtrees which lead to a sure win and you have a strong computer player.
Hope this helps - I won't go into more detail, it's your programming exercise.