Chess Programming Resources

Links to tutorials and descriptions on writing a computer chess program

Most of these links overlap each other in content, which can be a good thing. With different presentations of the same topics, there is a good chance you will find one that makes sense to you.

Dictionary of computer chess terms
Wikipedia article on computer chess : An introduction on the subject
Chess Programming Wiki : The repository of knowledge for chess programming
Computer Chess Club (also known as TalkChess) : The most popular forum for chess programmers
Winboard forum : Many questions asked and answered here
OpenChess Forum : An additional location where computer chess programmers share information and answer questions
A 6 part tutorial at gamedev.net about writing a chess program by François Dominic Laramée :
Part 1; Part 2; Part 3; Part 4; Part 5; Part 6
Bruce Moreland pages : A download of Bruce Moreland's much lauded website devoted to explaining how to write a chess engine can be found here
Evert Glebbeek : The author of Jazz, Sjaak, and Leonidas discusses some of the preliminary design decisions made for Jazz and Sjaak as well as certain search techniques and evaluation considerations (under Programming details in index)
Computer Chess Programming Theory : Colin Frayn's (author of ColChess and Beowulf) page on various chess programming methods
Thomas Petzke : A tutorial on how to write a chess engine from scratch by the author of iCE
Stef Luijten : A step-by-step guide on how to write a bitboard engine by the author of Wing
Adam Berent : A web site documenting the development of Adam's chess program, ChessBin
A Beginner's Guide to Chess Programming : by Adam Oellermann, author of Blikskottel
SecondChess : A continuation of FirstChess by Emilio Díaz. Its main goal is to add the necessary code to firstchess in order to make it play real chess, especially adding the rules for castle and en passant capture, focusing on an easy to read code.
Jamca : A tutorial by Eli Bendersky
Chris Moreton : The author of Rival gives an overview of how his engine plays chess
Jonatan Pettersson : Follow the process of creating the Mediocre chess engine
The inner work of a chess program : A brief introduction to how a chess engine works by Ed Schröder, author of Rebel and one of the legends of computer chess
Programmer Corner : A look inside Rebel, Ed Schröder's chess engine (now known as ProDeo)
Inside Rebel : The above information in PDF format
micro-Max : A multi-page description of the inner workings of Harm Geert Mulller's micro-engine, micro-Max
Winboard protocol driver : Code shared by H.G. Muller which will allow an engine to respond to Winboard commands
Winboard commands : A reference page for the Winboard protocol
WinBoard/XBoard protocol state diagram
UCI commands : Reference page for UCI protocol
Andrea Schalk : A good chess programming tutorial in PDF format
Nicola Rizzuti : A guide to writing a chess engine by the author of Mizar
Computer Chess Programming : A now dormant blog that contains information concerning chess programming
Borko Boškovic : Contains links to information concerning the theory of computer chess
MTD(f) : A webpage discussing an alternative to negascout
Chess Programming : Contains a partial tutorial on programming in JavaScript and 0x88 board representation
How to develop a chess program for dummys : A tutorial based on Huo chess engine and C#
Ernst Heinz : The author of Dark Thought describes how the engine plays chess
Computer chess game theory : Some notes on computer chess from Dr. A. N. Walker
Scott Gasch : A description of how his engine Typhoon plays chess
An Introduction to Late Move Reductions : A description of LMR by Tord Romstad
KC CHESS: Kevin & Craig's Chess Program : A description of an undergraduate project to build a chess program
Louis Kessler's Chess and Computer Chess Links : Has links to historical information and research about computer chess
The Anatomy of Chess Programs : A description by Tony Marsland
Strategy and board game programming (1997) : Lectures on chess programming by David Eppstein
Strategy and board game programming (1999) : Some additional lectures
Pradu Kannan : Web site has links to various chess programming topics, including multi-threading
Machine Learning in Games : A web site devoted to how computers learn to play games, including chess
Programming a Computer for Playing Chess : The pioneering paper on computer chess programming by Claude Shannon
Programming a Computer for Playing Chess (pdf)
Programmer Stuff : Various computer chess research papers
Some Aspects Of Chess Programming : An overview of common knowledge about modern chess programming
Games Playing with Computers :
COMPUTER CHESS : EXPLORING SPEED AND INTELLIGENCE : An account of the process of creating a chess program
Memory versus Search in Games : Dennis Breukerd's Ph.D. thesis
Magic Move-Bitboard Generation in Computer Chess : Pradu Kannan's explanation of magic bitboards
Chess Board and Moving Pieces in C++
Strategy Game Programming : A tutorial for stategy games (including chess) created by Martin Fierz
Dr. Robert Hyatt : Online technical papers from Bob Hyatt, the primary author of Blitz, world champion Cray Blitz, and Crafty, and a leading computer chess researcher for over 40 years
New Architectures in Computer Chess : Fritz Reul's Ph.D. thesis in PDF format
Using Genetic Algorithms to Learn Weights for Simple King-Pawn Chess Endgames : A research project by Chris Wyman
Computer Chess : A look at chess programming presented by Guy Robinson
Parallelizing a Simple Chess Program
Little Chess Evaluation Compendium : A paper by Lyudmil Tsvetkov which attempts to identify and give a value to important evaluation terms
Addendum to the Little Chess Evaluation Compendium
Bibob : A bitboard utility created by Gerd Isenberg
BLH2 : A bitboard utility created by Julien MARCEL
BLH2_Mac : Julien's tool compiled for Macs
The Chess Engine Factory App 2.0.1 : An app for exploring how a chess engine works (for Mac OS X 10.7 & 10.8)
Vice (Video Instructional Chess Engine) : A series of YouTube videos that feature details involved in creating a simple chess engine
Minimax with Alpha-Beta Pruning : An introduction to the Alpha-Beta algorithmn
Peter Ellis Jones - Chess Engine Part I: Choosing Internal Data Structures and Parsing Forsyth Edwards Notation
Peter Ellis Jones - Chess Engine Part II: Move Encoding and Move Generation for Non-Sliding Pieces


Open Source Links

FirstChess
SecondChess
TSCP
MSCP
Faile
Gerbil
CPW
Fruit 2.1

Source code for many engines can be found in the engine downloads at
The current repository of Jim Ablett's Winboard Projects

Open source engines to study as suggested by Dann Corbit, the man in CC who has possibly seen the most computer chess code.

C engine using 0x88 ==> VanillaChess
C bitboard engine ==> Olithink and Sungorus {followed by Rodent}
C++ non-bitboard engines ==> SamChess, Powder and PurpleHaze
C++ bitboard engines ==> DiscoCheck, Greko, Murka
SMP implementation ==> Viper, Scorpio
Ippolit code ==> GullChess with the following correction:

Gull has the same defect in loading the material imbalance array as all of the other IPPO* programs do, but it is easy to correct.
To correct the problem for all of them (but specifically in this instance for GULL), create the following macro:

#define INDEX_CHECK(index, array) assert((index) >= 0 && (index) < sizeof array / sizeof array[0]);
then add the following check in InitMaterial()...
After the calculation of index as follows:
index = wp*MatWP+bp*MatBP+wn*MatWN+bn*MatBN+wl*MatWL+bl*MatBL+wd*MatWD+bd*MatBD+wr*MatWR+br*MatBR+wq*MatWQ+bq*MatBQ;
Make this call:
INDEX_CHECK(index, Material);
And you will easily see the problem. It's not just a problem for later lookups (since the material condition that causes overflow basically never happens anyway) but in initialization of the array, it actually overwrites the memory array bounds and stomps onto who-knows-what.