Mailbox

From Chessprogramming wiki
Jump to: navigation, search

Home * Board Representation * Mailbox

A fantastical mailbox [1]

Mailbox, (Offset board representation [2]) a square-centric board representation where the encoding of every square resides in a separately addressable memory element, usually an element of an array for random access. The square number, or its file and rank, acts like an address to a post box, which might be empty or may contain one chess piece. As pointed out by Harm Geert Muller, not only the embedded 10x12 board, but various implementations are all mailbox, independently from elements in the array for padding that can act as a sentinel value [3].

Implementations

0x88

Pros & cons

Pros

  • Easy, straightforward to understand and implement
  • Suitable with the same efficiency for any size of boards, from one can be fitted on 64-bit integers to much larger. Thus it is also easier to support multi-chess variants which boards’ sizes are quite different.
  • Suitable for almost all chess tasks and software where computing speed is not high requirements such as chess tools, GUI since it is much easier to develop and maintain.

Newcomers are suggested to implement their first chess engines using Mailbox thus they can get some basic knowledge and skills before starting more complicated chess projects.

Cons

In the view of developing chess engines:

  • Programming must use many loop and branch commands such as for, while, if (compare with Bitboards)
  • Hard to store patterns and match them
  • May have some inefficient high-frequency-use functions such as finding King locations, in-check
  • Not efficient to generate moves in stages since generating all moves, captures only, non-captures may take quite similar periods

Speed

For basic tasks such as generating, making/unmaking moves, a "pure" mailbox maybe slower than Bitboards. However, when combining it with other methods such as Piece-Lists and optimize the code it could be as fast as Bitboards[4]

See also

Publications

Forum Posts

External Links

References

Up one Level