How does a chess computer play? In general, computer chess programs consider chess as a “tree of variations”. They examine all moves, then all counter-moves to those moves, then all moves countering them, and so on. Each individual move by one player is called a “ply”. This evaluation continues until a certain maximum search depth is reached, or the program determines that a final “leaf” position (e.g. checkmate) has been reached.
In the first paper on the subject, Claude Shannon (1950) suggested two possible search strategies for computer chess play, which he labelled “Type A” and “Type B”.
Type A programs would use a “brute force” approach, examining every possible position for a fixed number of moves, but Shannon thought this would be impractical for two reasons.
Firstly, with approximately thirty moves possible in a typical position, searching the 10 9 positions involved in looking three moves ahead for both sides (six ply) would take about sixteen minutes in the “very optimistic” (for 1950) case that the computer evaluated a million positions every second. It took about forty years for chess computers to achieve this speed.
Secondly, Type A searches would ignore the problem of “quiescence”, evaluating ALL positions, not just those reached at the end of an exchange of pieces or other important sequence of moves. Exhaustively looking at such a large number of positions would slow the program down enormously.
Instead of wasting processing power examining bad or trivial moves, Shannon suggested that Type B programs would use two improvements: Employ a quiescence search; Only look at a few good moves for each position. All modern programs employ a terminal quiescence search before evaluating positions.
Shannon’s second Type B improvement is much harder to implement! How is a decision made, in any given position, as to which moves merit further consideration? This is such a difficult programming task that most advances in computer chess have been gained by accelerating Type A searches with improved software techniques and faster hardware. Focusing on a few good moves for each position is best done by …
How does a human chessmaster play? Experts in a particular field usually solve problems more quickly, and with a higher success rate than do novices. But what is behind this faster speed and greater success? Are experts smarter than novices? Do they approach problems in a different way?
Human problem solving processes and methods have been studied by psychologists for over 100 years. To solve complex problems in a variety of fields (e.g. mathematics, physics, electronics, one’s personal life, or chess), it is often useful to apply a rule of thumb, make an educated guess, trust one’s intuitive judgement, or just use common sense. These sorts of methods are collectively known as “heuristics”.
Further heuristics that might make a problem more accessible include: using an analogy, decomposing the problem, and recombining its elements in some new manner, working backwards, using deduction, looking for a pattern, solving a slightly different problem, and applying the solution to your own problem (Polya 1945).
Using heuristics, masters look at about forty or fifty positions before deciding what move to play. When IBM’s Deep Blue defeated Gary Kasparov in a six-game match in 1997 it was the first time a reigning world champion lost a match to a computer opponent in tournament play. Deep Blue was a combination of special purpose hardware and software with an IBM RS/6000 SP2 (seen here), capable of examining 200 million moves per second, or 50 billion positions, in the three minutes allocated for a single move in a chess game. Despite this ‘advantage’, the match was remarkably close; a testament to the power of heuristic thinking.
The above heuristics are a selection from George Polya’s (1887-1985) 1945 book, How to Solve It. Though Polya was a mathematician, his general scheme for problem solving was intended to help people in a variety of fields.
According to Polya, the use of heuristics falls within the application of four principles that need to be followed in any serious attempt at problem solving: understanding the problem, devising a plan, carrying out the plan, looking back (reflecting). These steps, along with the use of heuristics, will be investigated in the remaining lessons.
Searching a “tree of variations”. Applying clever heuristics. Can there be another distinctly different way to play chess?
How might an alien play? Follow books and databases It is possible to duplicate the moves played by previous players. Such copying may be done judiciously, with a complete understanding of the ideas involved, or in complete ignorance. Sites such as www.shredderchess.com provide an opening database that compiles the results of hundreds of thousands of previous master games, and moves can be selected on the basis of either their popularity or success.
Endgame tablebases Working backwards from a checkmate position, endgame tablebases can be generated by retrograde analysis. Tablebases have solved chess for every position with six or fewer pieces. Creating and storing tablebases is very resource- expensive. A seven-man tablebase will require about 600 terrabytes of storage. A complete 6-man endgame tablebase can be accessed at www.shredder.com.
References Polya, G. (1945). How to solve it. Princeton, N.J.: Princeton University Press. Shannon, C.E. (1950). Programming a computer for playing chess. Philosophical Magazine, 7th series, 41, no. 314, 256-75.