                            King Slayer
                    a Chess engine by H.G.Muller

King Slayer is intended to be an inspiration for beginning Chess-engine
programmers, and illustrates the basic techniques of tree searching as
applied to Chess. Its source code is extensively commented to explain
the workings of the code.

King Slayer is based on a 16x8 'mailbox' board, i.e. a separate memory
location is used to describe the content of each board square. Only the
first 8 files of the board array are used. This so-called 0x88 design
makes the difference between square numbers unique, so that this
difference can be used to determine if pieces are aligned for capture,
what their distance measured in King steps is, etc.

King Slayer represents moves as 32-bit integers, of which only the
lowest 3 bytes are used. These 3 bytes contain the from- and to-square
of the move, and either a third square (the 'e.p. square') or a piece
'upgrade'. Square numbers in the 0x88 system leave two bits of a byte
unused, and these bits in the e.p-square byte are used as flags to
indicate whether this byte does hold an actual e.p. square (from which
the occupant should disappear as a side effect of the move), or a
number to be added to the piece code after the mobe (to effect promotion).
Normal moves are considered promotions with an upgrade 0. Each move can
thus either be a promotion or have a second capture victim, making it
easy for this engine to handle Chess variants that involve double
captures.

King Slayer does contain 'light' versions of the most common evaluation
terms: piece-square tables interpolated between opening and end-game
values, piece mobility, Pawn structure, sped up by a Pawn hash table,
some patterns for trapped pieces, King safety through Pawn-shield
quality and King seige (squares next to King under enemy attack),
score reduction when mate potential is jeopardized or absent,
and recognition of some well-known draw positions in the late end-game
(e.g. the opposition rule in KPK).

King Slayer's search does incorporate techniques such as internal
iterative deepening, quiescence search, check extension, null-move
pruning, late-move reductions. And of course a transposition table.

Have fun,
H.G. Muller
Sept 30, 2015
