Manak Ahluwalia's AI Project
PROJECT

Contents
Domain
Illustration
Methods
Conclusions

Domain

Simulated Human Observations and Use of Tactics

SHOUT was designed to mimic human tactics during game play. The computer was to act as an independent entity, that realistically and intelligently responded to a players game moves. The beginning stages of design dealt strictly with the rules of the game and ensured first most that the game would be able to be played correctly. The second phase of design dealt with developing the computer as an agent within the game. 


Illustration and Methods

Lets begin with the fundamentals of the game.

The Game itself is called Connect Three. The fundamentals are very simple. The game is played on a 5x5 board. Two players alternate placing red and black tiles into the game board. The first player to make 3 in a row in any direction of their respected color wins the game. The programming of this logic in the game had to take certain things into consideration.

- First the game had to learn the essence of the board existing. Breaking the 5x5 board into individual cells and numbering them created this. Each cell had the ability to contain either a black, red, or null. A Simple prolog line would implement this. I.e. [ is(Cell#, Val) ]. When the game began all cells would be given the null value. If a player attempted to insert a block in a cell that was either red or black an error would be popped back.

- Second it was understood that the blocks were stacked. Therefore it would have to check if the bottom cell was full before it would allow a block in that respective cell. This was as well done with a preprogrammed list of possible combinations. I.e. before the game began all cells were programmed with below constraints. Before adding a block to a cell it would check 3 things. First if that cell was empty through the is clause. Second if the cell below it was full, again with a query to the is clause. Finally it would then place the block in that slot.

- Finally on every end of a move the game would check for a possible winner. The list of preprogrammed possible combinations would be searched through, and the game would check to see if three of the same color matched one of those combinations. If so the game would end. If not, and while all cells were not filled the game would continue, if all the cells filled up the game would restart with no winner.

With the logic behind the game built, I began to focus on how a human would attack a game like this. Not only did I need to develop a human's plan of actions (or tactics), but rather how the computer could mimic this behavior. In my observations I noticed that human players break the game into 4 standard approaches. These approaches later became directives that the computer would play by. I felt that:

- If at all possible if you could win on a particular move that you would go for that move.

- Secondly, if you could not win then you were next inclined to stopping your opponent at winning at the next move.

- If this was not an option either, I felt that you would try to setup a move where about you could win on the next move. Preferably where you could win in more than one place.

- Finally, if you could not setup a move, you would be inclined to prevent the other player from setting up a winning move.

 

Since the game was built within guidelines, and the computer was preprogrammed with possible winning combinations. Every move was simply a search through winning configurations to determine the next move. You would search if you could possibly win on this move, if that combination didn't exist you would search if your opponent had 2 out of the three winning combination pieces and the third being null. If winning or blocking wasn't an option, you would check to see if you could place a piece that would give you more that 1 winning combination with a 3rd piece being null. Finally if winning combinations are out of reach you would prevent your opponent from gaining one. Through searches these directives are enforced, and it is possible to mimic intelligence in the computer opponent. The computer actually thinks and reacts as a human would.


Conclusions

I found that in programming this application that more complex methods needed to be created to make a real simulated game. My game had a list of preprogrammed winning combinations, and the computer would search through all of the possibilities. In all it was a cool experience in learning about approaches to AI, and the way computer programmers attack gameplay.