Advertisement

Chess Programming Tutorials or Freeware Chess Engine

Started by February 12, 2003 07:16 PM
7 comments, last by giant 21 years, 6 months ago
Hi. I am looking for what is probably the most available thing in AI but I cant find it. I have programmed a 3d interface for a chess game, but now I want to make it play chess. I have spent a few hours over the last few days searching with google to find some tutorials to teach me how to program a chess AI engine. I cant find what I need. There are a lot of papers etc.. which give theory but I cannot find any real tutorials that show you how to program such an engine in C++. If you know of any please let me know. Other than this, do you know any good freeware chess engines which can be easially used with a C++ DIrectX game. Thanks Giant
Perhaps you should check our very own "Articles & Resources" section?

Dave Mark - President and Lead Designer
Intrinsic Algorithm - "Reducing the world to mathematical equations!"

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

Advertisement
There are commonly used chess interface protocols (see WinBoard and GNU Chess).

As far as writing a chess AI: There is a good article about it here on Slashdot (probably under Articles & resources).

Do a search for "Game Tree" on google. That should start you out nicely.


Good luck.
Will
------------------http://www.nentari.com
Here''s the basics of the search engine involved for any 2-player game in which full knowledge of the position is known (i.e. for chess, checkers, mancala, etc):

http://www.xs4all.nl/~verhelst/chess/search.html

Jason Doucette
www.jasondoucette.com
Jason Doucette / Xona.comDuality: ZF — Xbox 360 classic arcade shmup featuring Dual Play
Err, did I say ''here on Slashdot''????

I meant here on GameDev, there is an excellent article about chess programming.

Cheers,
Will
------------------http://www.nentari.com
I''d suggest looking for books on the subject by David Levy, such as "Computer Gamesmanship" or "Computer Games I".

quote: Original post by giant
I am looking for what is probably the most available thing in AI but I cant find it. I have programmed a 3d interface for a chess game, but now I want to make it play chess. I have spent a few hours over the last few days searching with google to find some tutorials to teach me how to program a chess AI engine. I cant find what I need. There are a lot of papers etc.. which give theory but I cannot find any real tutorials that show you how to program such an engine in C++. If you know of any please let me know. Other than this, do you know any good freeware chess engines which can be easially used with a C++ DIrectX game.
Advertisement
I thought about how to write a chess ai on my way hom from school on the buss a couple of weeks ago, I came up with a simple but probably not so good algorithm for playing chess.
for each of the pieces on the board (that has the color of the ai black or white), try all the different moves u can make with it, first check if they are possible(ie no other pieces blocking the move) then evaluate the move from from some rules.
if u take some of the enemys pieces or if u move the piece so that u get control of a part of the board that is not controlled. then do the move that has the best score. This algoritm can be performed recursivly as well so u can plan ahead for a few moves... i hope u understand what i mean.
Thats a very good approach. It should please you to know that what you described is kind of what everybody is alread doing.

Most chess programs (and other game programms of a similar nature) use something called a game tree. A game tree is simply a ''tree'' of all possible moves. Of course, we can''t look at every single possible move in chess, so it''s usually all possible moves for 8 moves. By working backwards (from the bottom of the tree) it is possible to determine what the best course action is. As you will see, if you write a chess program, this is far from perfect, but is still quite effective.

You can find some excellent resources on game trees on the Internet. There are many adaptions on the Game tree idea which enhance it''s speed.

If I were you, I would start out by writting a Tic-Tac-Toe, or Connect-4 game. The heart of these games is essentially the same as chess, but they have less complicated rules so you will be able to ''understand'' the algorithm easier. Once you''ve got your tic-tac-toe or Connect-4 running, try chess.

Do a search for ''Game Tree'' and ''Alpha Beta'' on google, and you''re bound to find something usefull.

Best of luck,
Will
------------------http://www.nentari.com
The URL I posted above explains exactly that:

Chess Tree Search

Take a look.

Jason Doucette
www.jasondoucette.com
Jason Doucette / Xona.comDuality: ZF — Xbox 360 classic arcade shmup featuring Dual Play

This topic is closed to new replies.

Advertisement