Author: Gregg Jackson
Date: 10:54:52 09/15/03
Hi I am writing an article about chess programming for an AI site, based entirely on my own experience, I would be grateful for opinions from pro or experienced chess programmers. Its meant to be basic and introductory.. =============== Simple chess programming project 1) Draw the board and an interface to it for the player(s). This should give you a chess game that two people can play, taking it in turns to move a peice, sharing the mouse in the process. If you want to be really flash you can write a networked version but its your decision. Having completed this stage you will have had to write code to reject invalid moves for each player, as well as reject a move when the wrong color piece is selected. This may sound basic plus not have any AI, but believe me there is a lot of work here particularly if this is your first chess program. The meat of all that will eventually be required is here though - the looping, branching, checking etc that should give you a good idea of what happens in all chess programs, regardless of how you do your code. 2) The next step in this evolving chess project is to make room to incorporate AI (trumpet fanfare!!). At this point you could either write some AI 'in house' ie as part of the chess program itself, or write a separate AI routine with no graphics etc that runs as a separate program. For the latter, you can design a configuration screen or menu option where for both Black and White you can select either Human or Computer player, and if you choose Computer you specify a folder where text files/cookies etc will be placed. Whenever it is a computer players turn, your chess program dumps a small text file or something similar to this directory, then waits/polls the directory for the small text file the external computer program will return, then reads it in, validates it and moves that players piece accordingly. The beauty of this approach is that you can can play against your computer either as Black or White, or even have the computer play against itself* You can also write your external AI player without any need of a graphical interface etc, allowing you to concentrate purely on code. You can enable this in your program above without having to even write the AI yet too, which we will get to next. *Or later, other AI's! 3) The AI Having written all the code necessary to validate manual moves made by the players, then written the code to validate incoming moves proposed by Computer players (unless you managed to use the same routine for both), you will be in a prime position to start dreaming up Chess AI - in fact some ideas may be floating around already. An easy and good first step now is to write an external Chess AI program that reads in a text file, lists all possible moves it can make, then just picks one at random, and returns a text file detailing this move for your above system to read. You should be able to knock this up fairly quickly, then you can set your system up above and play against this, your MKI AI :) It can certainly help debug the entire external mechanism, and the board system you already wrote, plus it can serve as a bottom level benchmark for if you start making your Chess AI 'think'. 4) What is a good move in chess? This is what its all about really. There is not much more one can say, beyond that this is where all the fun lies. Most people will agree though that what is definately needed here is speed. However, with all the game side, and 'boring stuff' out of the way, you can concentrate purely on the AI, and being separate from the game mechanism, you should be free to choose any approach you want. Some AI thoughts Assigning points to pieces Assigning points to squares Bit boards Have fun! =========== I am not happy with the ending, it feels like I ought to finish on more of a bang. Its just I haven't got much further than this myself so I am not sure what to write. Any comments at all would be appreciated. Thanks, Gregg
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.