Contents Domain Illustration Methods Conclusions |
Domain The Domain is an 8x8 Chessboard at any given moment in a game. On this board there are of course different chess pieces ranging from pawns to kings and everything in between. As well as the pieces themselves there are all of the movement rules that apply to them as well as the restrictions of movment based on the current position of the board. An example of this would be preventing the king from making a move that would otherwise be legal, but place it in check. The board is mostly empty. The game has been one of heavy casualty with nothing but a king and one piece for each side. The side that PIECE will be looking at is white, who has besides his king only a rook. Black has a king and a single pawn one move away from promotion. PIECE looks at its pieces and assembles all of their available legal moves and then assigns a point value to each based on several factors. The move it finally selects is to place its rook in its home row, thusly preventing the opponent from promoting, which carries the piece value of a queen. .o.o.o.o .o.o.o.o PIECE works by using a simple 2 tier process of searching and selecting a move. The first thing it does when asked to provide the 'best' move a player can make is to figure out all of the legal moves the designated player can make, and then from those assign point values based on several simple decisions, such as escaping check, threatening/capturing enemy pieces, and blocking the opponent from checking or promoting. While not a prize-winning method of selecting a move, this will eliminate obviously bad moves and rarely fail to make at least an acceptable move given the board positioning. It would be especially helpful to a beginner who if for example this was placed into a small portable device could keep track of the board on it and press a button at any time they feel lost and PIECE would select a possible move for them. The move ranking system itself would use traditional point values that have already been established for pieces. As well as adding or subtracting cetain arbitrary values from them based on whether a given move would expose a piece to threat, and whether it would threaten an enemy peice. Further tailoring could be given by assigning slightly higher point values to moves that go towards the center of the board horizontally, and towards the opponents' side of the board vertically. The basic available move engine itself is simply a knowledge base of the movement rules for individual pieces, coded into prolog, combined with some rules based on currently allowable movement (you cannot capture your own piece, cannot pass through a piece sliding wise (anyone but the knight). And cannot make a move which would expose your king to existing check. Even this, very basic chess playing AI has turned out to be phenomaly complex in regards to a class project. The movement rules alone when formalized make up more prolog than many other projects need in their totality, and adding the move limiting factors to them as well as the ranking system simply increases their complexity nearly exponentially. One thing, that given the 20/20 nature of hindsight would have been perhaps abit better would be to rather than attempt a full chess AI that works within any given game, make an AI that centers on simply a small 'chess based' subset game, with perhaps only a rook, bishop, and king. This would avoid alot of problems I encountered trying to code in the duality of pawn movement/capture... knights movements... etc. This would also enable the entire engine to run much faster as there would only be several pieces on each side and thus the complexity of analyzing each individual possible move to make would be drastically less. Eventhough due to the immense complexity of this attempted project, I was not able to finish, I still have enjoyed working on it. It has helped to give me an appreciation for just how complex AI programming can be, and also for the game of chess itself and our mind's ability to understand it. In just a few short games the human mind can learn and understand so much of the game at such a fundamental level that my pale engine wouldn't be able to win the game even after hundreds of hours of fine tuning and tweaking. |