Bitfoot

From Chessprogramming wiki
Jump to: navigation, search

Home * Engines * Bitfoot

Bitfoot,
a version of Clubfoot, the UCI open source chess engine written by Shawn Chidester in C++, that uses bitboards [1]. The search mechanics of this engine are identical to those used in Clubfoot. The differences are board representation, move generation, and positional evaluation. Bitfoot uses bitboard for board representaion, Clubfoot uses 0x88 board representation. Move generation is strongly tied to board representation so move generation between the two engines is implicitly different. Positional evaluation in Bitfoot takes advantage of the capabilities enabled by using bitboards. So Bitfoot's positional evaluation is much more advanced than Clubfoot's. That being said, Bitfoot's positional evaluation is still relatively dump compared to many of today's top engines.

A/B Bitboards

Bitfoot applies an own technique to determine sliding piece attacks dubbed A/B Bitboards or Above/Below Bitboards [2]. Similar to the classical approach, it works ray-wise and uses pre-calculated ray-attacks for each of the eight ray-directions and each of the 64 squares. It has to distinguish between positive and negative directions, because it has to isolate or bitscan the first blocker (if any) from the ray-attack intersection with the occupancy in different orders. The exclusion of squares behind the first blocker works by intersection with its appropriate below or above separation. This is how the routines look like conform to the classical approach prototype:

U64 rayAttacks[8][64];

U64 getPositiveRayAttacks(U64 occupied, enumDir dir8, enumSquare square) {
  U64 x = rayAttacks[dir8][square] & occupied;
  x = x & -x; // LSB (if any)
  return x | (rayAttacks[dir8][square] & (x-1)); // BELOW
}

U64 getNegativeRayAttacks(U64 occupied, enumDir dir8, enumSquare square) {
  U64 x = rayAttacks[dir8][square] & occupied;
  x = x ? C64(1) << bitScanReverse(x) : C64(0); // MSB (if any)
  return x | (rayAttacks[dir8][square] & (x^-x)); // ABOVE
}

There are further versions of the routines leaving distinct sets of attacked blocker (and possible capture targets) or attacked empty squares, target of quiet moves.

See also

Forum Posts

External Links

Michael Brecker, Randy Brecker, Mike Stern, Dennis Chambers, George Whitty, James Genus

References

Up one Level