From Chessprogramming wiki
Jump to: navigation, search

Home * Engines * KnightCap

KnightCap's 3D Board [1]

a XBoard compliant open source chess engine under the GNU General Public License by Andrew Tridgell [2], Jonathan Baxter and Lex Weaver. To tune it's evaluation in game play, it uses temporal difference learning applied to minimax search in chess, TDLeaf [3] [4]. KnightCap features an own GUI with an optional 3D Graphics Board [5], and played multiple Australasian National Computer Chess Championships, and won two times, last one the NC3 2006.


Board Representation

KnightCap maintains an incremental updated attack table of 64 piece-sets - for each square indicating all pieces attacking or defending that square. Despite move generation, this approach pays off in determining in-check, and square control evaluation.


The program performs a iterative deepening parallel MTD(f) search utilizing the shared transposition table. The variation of MTD(f) that KnightCap uses includes some convergence acceleration heuristics that prevent the very slow convergence that can sometimes plague MTD(f) implementations. Selectivity is due to null move pruning, razoring and various extensions. The transposition table with 128 bit entries keeps separate depth and scores for the lower and upper bound. The move ordering system is a combination of the commonly used history, killer, refutation and transposition table, along with ETC.



KnightCap uses a quite slow evaluation function that evaluates a number of computationally expensive features such as board control to reasonably accurately consider the presence of hung, trapped and immobile pieces, and further has some asymmetric evaluation as well as search terms with a leaning towards careful play.

TD Considerations

One major modification for TDLeaf was that all evaluation coefficients became part of a weight vector. Another significant modification that was required was an increase in the bit resolution of the evaluation type so that a numerical partial derivative of the evaluation function with respect to the evaluation coefficient vector could be obtained with reasonable accuracy. To ensure small fluctuations in the relative values of leaf nodes did not produce large temporal differences, the raw linear leaf evaluation score was squashed to a ±1 range of a hyperbolic tangent sigmoid function with 0.25 equivalent a material superiority of one pawn. The outcome of the game was set to 1 for a win, -1 for a loss and 0 for a draw. Negative values of temporal differences (dt) were left unchanged as any decrease in the evaluation from one position to the next can be viewed as mistake. However, positive values of dt can occur simply because the opponent has made a blunder. To avoid KnightCap trying to learn to predict its opponent’s blunders, all positive temporal differences were set to zero unless KnightCap predicted the opponent’s move [6].

Selected Games

NC3 2006, round 2, Bodo - KnightCap

[Event "NC3 2006"]
[Site "RedHill, Canberra, Australia"]
[Date "2006.08.20"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 f6 85.exf6 Kf7 86.Kh1 Kxf6 87.Kh2 Kg5 88.Kg3 e5 89.Kf3 
Kh4 90.Kg2 Kxg4 91.Kf2 Kf4 92.Kg1 Ke3 93.Kf1 e4 94.Ke1 Kd3 95.Kf2 e3+ 96.Kg3 
Ke4 97.Kg2 e2 98.Kf2 Kd3 99.c4 Kd2 0-1

See also


1997 ...

2000 ...

Forum Posts

1997 ...

2000 ...

External Links


  1. Welcome to the KnightCap home page
  2. Andrew Tridgell (1997). KnightCap — a parallel chess program on the AP1000+.
  3. Jonathan Baxter, Andrew Tridgell, Lex Weaver (1997) Knightcap: A chess program that learns by combining td(λ) with minimax search. 15th International Conference on Machine Learning
  4. Re: Bit Board Bonkers?? - other alternatives by Andrew Tridgell, rgcc, August 9, 1997
  5. Re: Going commercial, maybe by Andrew Tridgell, rgcc, March 9, 1997
  6. Jonathan Baxter, Andrew Tridgell, Lex Weaver (1997) Knightcap: A chess program that learns by combining td(λ) with minimax search. 15th International Conference on Machine Learning
  7. Re: KnightCap source code by Jim Ablett, CCC, February 19, 2016

Up one level