Difference between revisions of "QBBEngine"

From Chessprogramming wiki
Jump to: navigation, search
(Created page with "'''Home * Engines * QBBEngine''' '''QBBEngine''',<br/> a didactic UCI compliant open source chess engine by Fabio Gobbato,...")
 
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
'''[[Main Page|Home]] * [[Engines]] * QBBEngine'''
 
'''[[Main Page|Home]] * [[Engines]] * QBBEngine'''
 +
 +
[[FILE:KTM Quad 990.jpg|border|right|thumb| A KTM Quad 990 ATV <ref>[https://commons.wikimedia.org/wiki/File:KTM_Quad_990_neutral.jpg A KTM Quad 990 ATV], custom-made from E-ATV Eicker Germany, Basevehicle was a KTM Supermotobike, Typ SM 990 with LC8 engine, Image by [https://commons.wikimedia.org/wiki/User:Ritchyblack Stefan Krause], February 20, 2011, [https://en.wikipedia.org/wiki/Wikimedia_Commons Wikimedia Commons]</ref> ]]
  
 
'''QBBEngine''',<br/>
 
'''QBBEngine''',<br/>
a didactic [[UCI]] compliant [[:Category:Open Source|open source chess engine]] by [[Fabio Gobbato]], written in [[C]] and published as single source file on the [[Pedone]] site <ref>[https://sites.google.com/site/pedonechess/ Pedone Chess Engine]</ref>.
+
a didactic [[UCI]] compliant [[:Category:Open Source|open source chess engine]] by [[Fabio Gobbato]], written in [[C]] and published as single source file along with [[Pedone]], which apparently uses a similar representation <ref>[https://sites.google.com/site/pedonechess/ Pedone Chess Engine]</ref>.
 
The QBBEngine demonstrates the use of a compact [[Quad-Bitboards|quad-bitboard]] structure to [[Board Representation|represent the board]],  
 
The QBBEngine demonstrates the use of a compact [[Quad-Bitboards|quad-bitboard]] structure to [[Board Representation|represent the board]],  
 
and further applies [[Alpha-Beta|alpha-beta search]] and an [[Evaluation|evaluation]] based on static values and [[Piece-Square Tables|piece-square tables]] <ref>[https://sites.google.com/site/pedonechess/a-didactic-engine QBBEngine - a didactic engine]</ref>.
 
and further applies [[Alpha-Beta|alpha-beta search]] and an [[Evaluation|evaluation]] based on static values and [[Piece-Square Tables|piece-square tables]] <ref>[https://sites.google.com/site/pedonechess/a-didactic-engine QBBEngine - a didactic engine]</ref>.
 
The program performs a color agnostic [[Move Generation|move generation]] by [[Color Flipping|flipping]] the board each time in [[Make Move|make move]].
 
The program performs a color agnostic [[Move Generation|move generation]] by [[Color Flipping|flipping]] the board each time in [[Make Move|make move]].
  
=Board-Definition=  
+
=Board-Definition=
The [[Bitboard Board-Definition|board-definition]] with vertical [[Nibble|nibbles]] as [[Pieces#PieceCoding|piece or empty square codes]]:
+
==C Structure==
 +
<pre>
 +
/*
 +
Board structure definition
 +
 
 +
PM,P0,P1,P2 are the 4 bitboards that contain the whole board
 +
PM is the bitboard with the side to move pieces
 +
P0,P1 and P2: with these bitboards you can obtain every type of pieces and every pieces combinations.
 +
*/
 +
typedef struct
 +
{
 +
  TBB PM;
 +
  TBB P0;
 +
  TBB P1;
 +
  TBB P2;
 +
  uint8_t CastleFlags; /* ..sl..SL  short long opponent SHORT LONG side to move */
 +
  uint8_t EnPassant; /* enpassant column, =8 if not set */
 +
  uint8_t Count50; /* 50 move rule counter */
 +
  uint8_t Rep; /* 0 if it's not a repetition, 1 if it is */
 +
  uint8_t STM; /* side to move */
 +
} TBoard;
 +
</pre>
 +
==Piece Coding==
 +
The [[Bitboard Board-Definition|board-definition]] with vertical [[Nibble|nibbles]] as [[Pieces#PieceCoding|piece or empty square codes]], i.e. the [[Initial Position|initial position]]:
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-

Latest revision as of 11:36, 7 September 2020

Home * Engines * QBBEngine

A KTM Quad 990 ATV [1]

QBBEngine,
a didactic UCI compliant open source chess engine by Fabio Gobbato, written in C and published as single source file along with Pedone, which apparently uses a similar representation [2]. The QBBEngine demonstrates the use of a compact quad-bitboard structure to represent the board, and further applies alpha-beta search and an evaluation based on static values and piece-square tables [3]. The program performs a color agnostic move generation by flipping the board each time in make move.

Board-Definition

C Structure

/*
Board structure definition

PM,P0,P1,P2 are the 4 bitboards that contain the whole board
PM is the bitboard with the side to move pieces
P0,P1 and P2: with these bitboards you can obtain every type of pieces and every pieces combinations.
*/
typedef struct
{
   TBB PM;
   TBB P0;
   TBB P1;
   TBB P2;
   uint8_t CastleFlags; /* ..sl..SL  short long opponent SHORT LONG side to move */
   uint8_t EnPassant; /* enpassant column, =8 if not set */
   uint8_t Count50; /* 50 move rule counter */
   uint8_t Rep; /* 0 if it's not a repetition, 1 if it is */
   uint8_t STM; /* side to move */
} TBoard;

Piece Coding

The board-definition with vertical nibbles as piece or empty square codes, i.e. the initial position:

Square 6 6 6 6 5 5 5 5 5 ~ 0 ... 0
3 2 1 0 9 8 7 6 5 ~ 8 7 6 5 4 3 2 1 0
Piece r n b k q b n r p ~ P R N B K Q B N R
PM 0 0 0 0 0 0 0 0 0 ~ 1 1 1 1 1 1 1 1 1 Side to Move
P0 0 0 1 0 1 1 0 0 1 ~ 1 0 0 1 0 1 1 0 0 P . B . Q
P1 0 1 1 1 0 1 1 0 0 ~ 0 0 1 1 1 0 1 1 0 N B . K
P2 1 0 0 1 1 0 0 1 0 ~ 0 1 0 0 1 1 0 0 1 . . R Q K
P2     RQK        P1    NB  K       P0   P B Q         PM side to move
1 . . 1 1 . . 1   . 1 1 . 1 1 1 .   . . 1 1 . 1 . .    . . . . . . . .
. . . . . . . .   . . . . . . . .   1 1 1 1 1 1 1 1    . . . . . . . .
. . . . . . . .   . . . . . . . .   . . . . . . . .    . . . . . . . .
. . . . . . . .   . . . . . . . .   . . . . . . . .    . . . . . . . .
. . . . . . . .   . . . . . . . .   . . . . . . . .    . . . . . . . .
. . . . . . . .   . . . . . . . .   . . . . . . . .    . . . . . . . .
. . . . . . . .   . . . . . . . .   1 1 1 1 1 1 1 1    1 1 1 1 1 1 1 1
1 . . 1 1 . . 1   . 1 1 . 1 1 1 .   . . 1 1 . 1 . .    1 1 1 1 1 1 1 1

See also

External Links

References

  1. A KTM Quad 990 ATV, custom-made from E-ATV Eicker Germany, Basevehicle was a KTM Supermotobike, Typ SM 990 with LC8 engine, Image by Stefan Krause, February 20, 2011, Wikimedia Commons
  2. Pedone Chess Engine
  3. QBBEngine - a didactic engine

Up one Level