Gibbon

From Chessprogramming wiki
Jump to: navigation, search

Home * Engines * Gibbon

Gibbons at Play [1]

Gibbon,
an UCI compliant open source chess engine by Eric Marathée written in C++. Gibbon originated from Small-C in 2005, playing Massy 2006 and improving since then. While featuring some bitboards, it has no annoying magic bitboard stuff, and is a counter approach of a Fruit like programming style, full of gotos, and difficult to follow control flow due to indent style and preprocessor switches for conditional compilation. Gibbon computes a few nodes, but is an attempt to compute the right ones [2].

Features

[3]

Search

Selectivity

Quiescence Search

Mate at a Glance

  • Mate in one recognition for queen moves
  • Heuristic to identify moves threatening mate with queen and piece

Evaluation

Opening

Middlegame

Endgame

Interior Node Recognizer

Misc

=> Gibbon knows all legal moves, material, mobility, and check-giving squares

BitScan with Reset

In serializing bitboards, Gibbon applies a bitscan with reset based on the De Bruijn multiplication approach published by Charles Leiserson, Harald Prokop and Keith H. Randall in 1998 [4]. The De Bruijn sequence chosen is even, which implies five leading zeros [5]:

/**
 * bitScanForward
 * @author Charles E. Leiserson
 *         Harald Prokop
 *         Keith H. Randall
 * "Using de Bruijn Sequences to Index a 1 in a Computer Word"
 * @param bb bitboard to scan
 * @precondition bb != 0
 * @return index (0..63) of least significant one bit
 */
const char xindex64[64] = {
   63,  0, 58,  1, 59, 47, 53,  2,
   60, 39, 48, 27, 54, 33, 42,  3,
   61, 51, 37, 40, 49, 18, 28, 20,
   55, 30, 34, 11, 43, 14, 22,  4,
   62, 57, 46, 52, 38, 26, 32, 41,
   50, 36, 17, 19, 29, 10, 13, 21,
   56, 45, 25, 31, 35, 16,  9, 12,
   44, 24, 15,  8, 23,  7,  6,  5
};

#define set_bit_to_0(x64,xr)     (x64) &= ~((unsigned __int64)1<<(xr)) 

char SEARCH::bitScanForward_Clear(unsigned __int64 &bb) 
{
   char index;
   unsigned __int64  debruijn64 =(unsigned __int64)(0x07EDD5E59A4E28C2);
   ASSERT (bb != 0);
   // Ignorer le warning de compilation
   index=xindex64[((bb & -bb) * debruijn64) >> 58];
   set_bit_to_0(bb, index);
   return index;
}

See also

Forum Posts

External Links

Chess Engine

Misc

References

  1. Gibbons at Play - Chinese painting 15th century, Hanging scroll, ink and colors on paper, Current location: National Palace Museum, Taipei, Taiwan, Gibbons Wikipedia.de (German)
  2. gibbon home page
  3. Features based on the gibbon home page
  4. Charles E. Leiserson, Harald Prokop, Keith H. Randall (1998). Using de Bruijn Sequences to Index a 1 in a Computer Word. pdf
  5. gibbon home page, Gibbon 2.57.a - uci - Cchess_2.h, Cchess_4.h, maj.cpp

Up one level