In my new Tabula library (
https://github.com/rhalbersma/tabula) that I am developing (not yet ready for primetime), I have been experimenting with new board layouts / square numberings. Here's the classic layout for a 10x10 draughts board by using 1 ghost column (also called "separating squares" or "guard band" by other board game programmers). This is equivalent to embedding the 10x10 board into a 11x10 board. Just as a reminder, 1 ghost column eliminates odd/even rows and also guards against edge detection for single-step diagonal moves.
Code: Select all
0 1 2 3 4
5 6 7 8 9
11 12 13 14 15
16 17 18 19 20
22 23 24 25 26
27 28 29 30 31
33 34 35 36 37
38 39 40 41 42
44 45 46 47 48
49 50 51 52 53
Below a slightly less familiar bit layout, one that I first described here over 10 years ago:
http://laatste.info/bb3/viewtopic.php?t=1925&start=249. It uses 3 ghost columns by embedding a 10x10 board into a 13x10 board. This continues to eliminate odd/even rows and now also guards against single-step orthogonal moves (and not just diagonal moves). I use it for edge detection in Frisian draughts (which has orthogonal captures). Amazingly, this same bit layout has als been used since 3 years by Fabien to accommodate Scan's large pattern indexing.
Code: Select all
0 1 2 3 4
6 7 8 9 10
13 14 15 16 17
19 20 21 22 23
26 27 28 29 30
32 33 34 35 36
39 40 41 42 43
45 46 47 48 49
52 53 54 55 56
58 59 60 61 62
Bitboard programs only need to worry about left/right edge effects since the top/bottom edges are taken care of by C++ unsigned integer bit-shifting behavior. Array-based programs also have to do edge detection at the top and bottom of the board. The easiest way to this is to embed a 10x10 board into a 11x12 board (with ghost columns on the top, right and bottom). This results in the following board layout (there are 66 squares in total, but square 0...5 and 60..65 are not shown). Fabien used this in his old array-based program and also in Scan 2 (correct me if I'm wrong!). In chess, this layout is similar in spirit as the classic "mailbox" 10x12 board layout:
https://www.chessprogramming.org/10x12_Board
Code: Select all
6 7 8 9 10
11 12 13 14 15
17 18 19 20 21
22 23 24 25 26
28 29 30 31 32
33 34 35 36 37
39 40 41 42 43
44 45 46 47 48
50 51 52 53 54
55 56 57 58 59
Another very nice layout for array-based programs is embedding the 10x10 board into a 19x10 board with 9 ghost columns. The square numbering then looks like this. In chess, this layout is supportive of so-called "vector attacks":
https://www.chessprogramming.org/Vector_Attacks. What special property does this 19x10 board have? Well, the 9 ghost columns mean that there are 95 internal squares (only the range 0...89 is required for bitboards) and square 94 is on a diagonal with square 4. It turns out that such a large board (and also even larger boards) have the property that all square differences have a unique direction. This means that if you want to know if there is a legal moves between two squares (or the distance between them), that you don't need to have a 50x50 lookup table, but only a much smaller table of size 179 (the range -89...0...+89 of all possible square differences). I don't know anyone using this layout, and I haven't had any experience with it myself. Incidentally, the 19x10 board is also a board in which 3 kings beat 1 king, for roughly the same reason (square 4 looking at two single corners at squares 85 and 94).
Code: Select all
0 1 2 3 4
9 10 11 12 13
19 20 21 22 23
28 29 30 31 32
38 39 40 41 42
47 48 49 50 51
57 58 59 60 61
66 67 68 69 70
76 77 78 79 80
85 86 87 88 89