Difference between revisions of "Mailbox"
(→Forum Posts) |
GerdIsenberg (talk | contribs) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 5: | Line 5: | ||
'''Mailbox''', (Offset board representation <ref>[http://www.craftychess.com/hyatt/boardrep.html Chess board representations] by [[Robert Hyatt]]</ref>) | '''Mailbox''', (Offset board representation <ref>[http://www.craftychess.com/hyatt/boardrep.html Chess board representations] by [[Robert Hyatt]]</ref>) | ||
a square-centric board representation where the [[Pieces#PieceCoding|encoding]] of every [[Squares|square]] resides in a separately addressable [[Memory|memory]] element, usually an element of an [[Array|array]] for random access. The square number, or its [[Files|file]] and [[Ranks|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|10x12 board]], but various implementations are all mailbox, independently from elements in the array for padding that can act as a [https://en.wikipedia.org/wiki/Sentinel_value sentinel value] <ref>[http://www.talkchess.com/forum/viewtopic.php?t=48164 mailbox & CPW] by [[Harm Geert Muller]], [[CCC]], May 31, 2013</ref>. | a square-centric board representation where the [[Pieces#PieceCoding|encoding]] of every [[Squares|square]] resides in a separately addressable [[Memory|memory]] element, usually an element of an [[Array|array]] for random access. The square number, or its [[Files|file]] and [[Ranks|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|10x12 board]], but various implementations are all mailbox, independently from elements in the array for padding that can act as a [https://en.wikipedia.org/wiki/Sentinel_value sentinel value] <ref>[http://www.talkchess.com/forum/viewtopic.php?t=48164 mailbox & CPW] by [[Harm Geert Muller]], [[CCC]], May 31, 2013</ref>. | ||
+ | |||
+ | =Implementations= | ||
+ | * [[8x8 Board]] | ||
+ | * [[10x12 Board]] | ||
+ | * [[Vector Attacks]] | ||
+ | : [[0x88]] | ||
=Pros & cons= | =Pros & cons= | ||
Line 21: | Line 27: | ||
* Not efficient to generate moves in stages since generating all moves, captures only, non-captures may take quite similar periods | * 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<ref>[http://talkchess.com/forum3/viewtopic.php?f=7&t=76773#p885878 The mailbox trials] by [[Pham Hong Nguyen|Nguyen Pham]], [[CCC]], Mar 04, 2021</ref> | |
− | |||
− | |||
− | |||
=See also= | =See also= | ||
Line 47: | Line 50: | ||
* [http://www.talkchess.com/forum/viewtopic.php?t=23191 move generation with one dimensional "12 x 10" array] by [[Andrew Short]], [[CCC]], August 22, 2008 | * [http://www.talkchess.com/forum/viewtopic.php?t=23191 move generation with one dimensional "12 x 10" array] by [[Andrew Short]], [[CCC]], August 22, 2008 | ||
* [http://www.talkchess.com/forum/viewtopic.php?t=48164 mailbox & CPW] by [[Harm Geert Muller]], [[CCC]], May 31, 2013 | * [http://www.talkchess.com/forum/viewtopic.php?t=48164 mailbox & CPW] by [[Harm Geert Muller]], [[CCC]], May 31, 2013 | ||
− | * [http://talkchess.com/forum3/viewtopic.php?f=7&t=76773 The mailbox trials] by [[Harm Geert Muller]], [[CCC]], | + | * [http://talkchess.com/forum3/viewtopic.php?f=7&t=76773 The mailbox trials] by [[Harm Geert Muller]], [[CCC]], March 04, 2021 <ref>[https://github.com/maksimKorzh/hgm-mailbox-trials/blob/main/mailbox7b.c hgm-mailbox-trials/mailbox7b.c at main · maksimKorzh/hgm-mailbox-trials · GitHub] hosted by [[Maksim Korzh]]</ref> |
=External Links= | =External Links= | ||
* [https://en.wikipedia.org/wiki/Board_representation_%28chess%29#Array_based Board representation (chess) - Array based from Wikipedia] | * [https://en.wikipedia.org/wiki/Board_representation_%28chess%29#Array_based Board representation (chess) - Array based from Wikipedia] | ||
− | * [http://www.craftychess.com/hyatt/boardrep.html Chess board representations] by [[Robert Hyatt]] | + | * [http://www.craftychess.com/hyatt/boardrep.html Chess board representations] by [[Robert Hyatt]] |
+ | * [https://github.com/maksimKorzh/hgm-mailbox-trials/blob/main/mailbox7b.c hgm-mailbox-trials/mailbox7b.c at main · maksimKorzh/hgm-mailbox-trials · GitHub] hosted by [[Maksim Korzh]] <ref>[http://talkchess.com/forum3/viewtopic.php?f=7&t=76773 The mailbox trials] by [[Harm Geert Muller]], [[CCC]], March 04, 2021</ref> | ||
* [https://en.wikipedia.org/wiki/Mailbox Mailbox (disambiguation) from Wikipedia] | * [https://en.wikipedia.org/wiki/Mailbox Mailbox (disambiguation) from Wikipedia] | ||
Latest revision as of 12:00, 13 June 2021
Home * Board Representation * Mailbox
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].
Contents
Implementations
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
- Claude Shannon (1949). Programming a Computer for Playing Chess. pdf from The Computer History Museum
- Dietrich Prinz (1952). Robot Chess. Research, Vol. 6, reprinted 1988 in Computer Chess Compendium
- Alex Bell (1972). Games Playing with Computers. Allen & Unwin, ISBN-13: 978-0080212227
- Dan Spracklen, Kathe Spracklen (1978). First Steps in Computer Chess Programming. BYTE, Vol. 3, No. 10, pdf from The Computer History Museum
- David Levy (1979). Computer and Chess - How the monster thinks. Elektor, January 1979 [5]
- Robert Hyatt (1981). Checkmate: The Cray-1 Plays Chess. Part 1. Cray Channels, Vol. 3, No. 1. pdf from The Computer History Museum
Forum Posts
- Bitboards vs Mailbox vs 0X88 by Bruce Cleaver, CCC, June 02, 1998 » 0x88, Bitboards
- 0x88 vs mailbox by Stuart Cracraft, CCC, September 16, 2004 » 0x88
- Mailbox info by Anonymous, Winboard Forum, May 08, 2005
- Board representation : 0x88 or 10x12 ? by Philippe, Winboard Forum, March 02, 2006 » 0x88
- move generation with one dimensional "12 x 10" array by Andrew Short, CCC, August 22, 2008
- mailbox & CPW by Harm Geert Muller, CCC, May 31, 2013
- The mailbox trials by Harm Geert Muller, CCC, March 04, 2021 [6]
External Links
- Board representation (chess) - Array based from Wikipedia
- Chess board representations by Robert Hyatt
- hgm-mailbox-trials/mailbox7b.c at main · maksimKorzh/hgm-mailbox-trials · GitHub hosted by Maksim Korzh [7]
- Mailbox (disambiguation) from Wikipedia
References
- ↑ A fantastical mailbox designed by Frederick C. Sauer around 1930 in the Sauer Buildings Historic District in Aspinwall, Pennsylvania. Image by Lee Paxton on May 16, 2010
- ↑ Chess board representations by Robert Hyatt
- ↑ mailbox & CPW by Harm Geert Muller, CCC, May 31, 2013
- ↑ The mailbox trials by Nguyen Pham, CCC, Mar 04, 2021
- ↑ Publication Archive from Chess Computer UK by Mike Watters
- ↑ hgm-mailbox-trials/mailbox7b.c at main · maksimKorzh/hgm-mailbox-trials · GitHub hosted by Maksim Korzh
- ↑ The mailbox trials by Harm Geert Muller, CCC, March 04, 2021