How Does the AI Work?
How Does the AI Work?The first thing one must do when composing a gaming AI is to ask himself what thinking process a human player would go through when playing the game. Normally, we come up with several strategies for any game. The next step would be to express these strategies into subprograms (functions) The scores in 3-Dimensional Tic-Tac-Toe are the number of lines achieved. Thus, the strategies of the game would be to make as many lines as possible while preventing the opponent from making lines. So the kind of spots best for the next move would be spots making a line or adding up the potential of making a line and spots blocking the opponent's (potential) line. When a human player is playing the game, he/she would be trying to compare different spots and choose the best one to play. This is like an evaluation process on the priority of different spots. To simulate such thinking process in AI, we give priority score to each spot and let AI play the spot receiving the highest score. So how do we give the scores? According to the strategies we mentioned above, a spot that helps making lines or preventing opponent from making lines should receive a high priority score. To express it more specifically, let's look at the following example:
Assume it's black's move:
An empty spot on a line where other two spots (notice that a line is composed of three spots) are both occupied by white's stones would be a block. Such empty spot should receive points for blocking.
If it's also on a line (notice that a spot can be on many lines) where other two spots are already occupied by black stones, this empty spot should also receive points for making a line.
If it's also on a line where one of the other two spots is also empty and the other spot is occupied by a white stone, this empty spot should also receive points for blocking a white's potential line. Obviously, the damage done by this block is not as great as the block in the first case. Thus, the points given here should be less than the points given in the first case.
If it's also on a line where one of the other two spots is also empty and the other spot is occupied by a black stone, this empty spot should also receive points for increasing the potential for black to make a line here. Obviously, the number of points given here should be lower than the number of points given in the second case where an actual line is made.
If it's also on a line where both of the other two spots are also empty (this empty spot is on an empty line), this empty spot should also receive points for increasing the potential for black to make a line here. Obviously, the number of points given here should be lower than the number of points given in the fourth case. The example above shows all the 5 possibilities for an empty spot to receive priority points. The AI will reconfigure the priority score for each empty spot each round and make the move on the spot receiving the highest score.

0 Comments:
Post a Comment
<< Home