hgm wrote:For orthodox Chess 2 guard rows is sufficient, to catch Knight moves. (And in Xiangqi it can also catch Cannon captures without special tests.) In fact none of the variants supported by WinBoard has pieces that can jump over 2 squares. (Such pieces are much too dangerous to give good variants.) One of the reasons I proposed Spartan Chess is that it uses a standard 8x8 board, so 0x88 and 12x16 can be used without modification.
Right I could have used 2 guard rows ,instead of 3, with an offset of 2 * 16 + 4 = 32.
Somehow I thought having all off-board squares on the right half (the way 0x88 board
is usually depcited) would make a difference. Anyway I will keep it because it can support
a 3-step straight jumper.It also allows me to store mid/end game values of a 0x88 board in a compact table where pst[sq] & pst[sq + 8]
represent mid/end game values, something not possible with a 15X12 board f.i.
In Joker80 I use a 12x32 board, so that I can use a 0x110 trick in stead of 0x88. In my Xiangqi and Shogi engine I abandoned the power-of-two rank size, because they have more than 8 ranks of more than 8 squares, and it was most important to limit square numbers to a single byte. In the Xiangqi engine I use a 14x20 board, because when I started writing it, it was intended as a general variant-capable engine for boards upto 10x10. For Shogi I use 13x18, to get maximum packing density of PST, and allow the holdings to be addressable by square numbers < 256, so that drop moves can be performed by the same code as normal moves.
From your experience, it is clear different bit-trick optimizations are possible depending on the
the board size & jumpers. I will give up all of those for a flexible board size.
It will surely be not the best representation for a specific game but robusteness is a priority
for this engine I am writing. I have to change also move representation and move history stack to
allow capture of multiple pieces and "insertion type of move" as in checkers & go.
This is a bit optimistic I know, but having one code to try out different board game ideas is
convinient.