Winglet

Home * Engines * Winglet

[ Winglet [1] Winglet,

a didactic open source chess engine by Stef Luijten, written in C++ and licensed under the GNU General Public License. The development of Winglet was documented on the website tutorial Winglet, Writing a Chess Program in 99 Steps, started in 2011, now hosted by the Wayback Machine [2]. Winglet is intended as bitboard version of TSCP with WinBoard support [3], and is loosely derived from Wing, Stef Luijten’s former private engine [4], in the meantime also open source [5].

Board Representation

Winglet applies a mixture of Kindergarten Bitboards and Magic Bitboards [6] to determine sliding piece attacks with 32 KiB precalculated lookup tables[64][64] each on ranks, files, diagonals and anti-diagonals, indexed by square and hashed line occupancy - the inner six bits multiplied by a magic factor and shifted right by the strange looking 57, while 58 is more natural to ensure a six bit index range, using a constant factor (b-File) for all squares of a diagonal or anti-diagonal, …


U64 arrDiagonalAttacks[64][64]] /* requires initialization */

U64 diagonalKindergartenAttacks(U64 occ, enumSquare sq) {
   occ = (diagonalMaskEx[sq] & occ) * C64(0x0202020202020202) >> 58;
   return arrDiagonalAttacks[sq][occ];
}

… but “magic” Winglet factors are designed such that the most significant bit of the 64-bit product will always be clear, that is positive if interpreted as signed 64-bit integer. It seems, Winglet’s occupied index calculations emulate Wing’s rotated bitboard indices for same attack table layout:


/*                 Winglet's occupancy state             ==            Wing's occupancy state */
(occ & MG_DIAGA8H1MASK[sq]) * MG_DIAGA8H1MAGIC[sq] >> 57 == (occ045 >> DIAGA8H1_ATTACK_SHIFT[sq]) & 63
(occ & MG_DIAGA1H8MASK[sq]) * MG_DIAGA1H8MAGIC[sq] >> 57 == (occ315 >> DIAGA1H8_ATTACK_SHIFT[sq]) & 63
(occ & MG_FILEMASK[sq])     * MG_FILEMAGIC[sq])    >> 57 == (occ090 >> FILE_ATTACK_SHIFT[sq])     & 63

Evaluation

Passed Pawn Backward Pawn Doubled Pawn Isolated Pawn

Pawn Shield King Tropism

See also

Forum Posts

Chess Engine

Tutorial Archive

01 Introduction - 05 First steps with Visual Studio C++ 06 Reading user commands 07 Internal representation of the chess board - bitboards » Board Representation, Bitboards 08 Displaying the position » Chess Position 09 Reading a FEN string » Forsyth-Edwards Notation 10 Setting up the board manually 11 The move generator » Move Generation 12 Making the moves » Make Move 13 The evaluation function » Evaluation 14 Search » Search, Minimax, Alpha-Beta, PVS 15 Mate and draw detection » Checkmate, Stalemate 16 Repetition detection - Zobrist keys » Repetitions, Zobrist Keys 17 Iterative deepening and move ordering » Iterative Deepening, Move Ordering 18 Quiescence search and SEE » Quiescence Search, MVV-LVA, SEE 19 Null move pruning » Null Move Pruning 20 Time control and running test suites » Time Management 21 Connecting to Winboard » CECP, WinBoard

Misc

References

  1. Winglet with attached tufts of an KC-135A during NASA Winglet stu dy 1979. The tufts are needed to measure the airflow, Winglet from Wingtip device - Wikipedia, KC-135 EC79-11481: KC-135A in flight - closeup of winglet with attached tufts, August 20, 1979
  2. Winglet, Writing a Chess Program in 99 Steps by Stef Luijten, hosted by the Wayback Machine
  3. Writing a chess program in xx steps by Stef Luijten, CCC, April 18, 2011
  4. Winglet, Writing a Chess Program in 99 Steps by Stef Luijten, hosted by the Wayback Machine
  5. Index of /chess/engines/Jim Ablett/WING by Jim Ablett, hosted by Kirill Kryukov
  6. Writing a chess program in 99 steps - Move generation for sliding pieces by Stef Luijten, Wayback Machine
  7. Chesser: A Chess Engine derived from wingletx by Syed Fahad, CCC, December 24, 2014
  8. ucarion/godot · GitHub
  9. kenshinthebattosai/Kenny · GitHub
  10. New Winboard Engine ‘Kenny’ - JA builds available by Jim Ablett, CCC, January 08, 2013
  11. Re: where to start chess programming? by Marco Belli, CCC, June 22, 2014

Up one Level