Perft on rectangular boards

Discussion about development of draughts in the time of computer and Internet.
Post Reply
Rein Halbersma
Posts: 1722
Joined: Wed Apr 14, 2004 16:04
Contact:

Perft on rectangular boards

Post by Rein Halbersma » Thu Nov 11, 2010 23:00

International draughts on a 10x10 board has a rather drawish endgame. In particular the ubiquitous 3kings vs 1king endgame is a draw, barring any tactics. It has been known for a long time, however, that rectangular boards of size (H+2 x H), size (H+1 x H) and size (2H-1 x H) allow a forced win for the majority side in this 3vs1 endgame.

In the former Soviet republics, people play on 8x8 and 10x10 and in the 70s and 80s some tournaments were organized by a master named Spantsireti for 10x8 boards. The program Aurora also supports this variant. Tjalling Goedemoed (Kosmos at this forum) organized some 11x10 and 12x10 tournaments a few years ago. He calls these variants Ktar-draughts, after some fictitious planet in outer space whose inhabitants are known to play this game. :wink:

I decided to see if my C++ template engine was up to the job for handling such boards. 10x8 and 11x10 posed no problems as the number of squares (including ghost squares) comfortably fit within 64 bits. The 12x10 board however, was a nuisance. I knew that I had to give up my conventional 2 column ghost layout that I use for the other boards, but even with 1 ghost column, the number of bits needed was either 65 or 66, depending on the color of the upper-left square. It turns out that a rotated bit layout (by 90 degrees in either direction) needs 1 ghost square less. The diagrams below tell the rest of the story: the perft(9) score is the first to deviate from the regular 10x10 perft numbers. This makes sense because at d=9 white can start moving pieces from his bottom row.

The programming trick I used was to factorize my Board class into a Ghost class and a Grid class, each representing a 12x10 board, but with an arbitrary angle of rotation between them (in steps of 90 degrees of course). With some simple geometry and arithmetic, it was rather straightforward to compute the various bitboards required for a correct and efficient move generator. As a pleasant by-product, the code refactoring also made my heavy C++ template machinery compile an order of magnitude faster 8)

Perhaps at a later stage I'll generate the 3vs1 databases for these boards.

Rein

Code: Select all

58  45  32  19   6
  52  39  26  13   0
59  46  33  20   7
  53  40  27  14   1
60  47  34  21   8
  54  41  28  15   2
61  48  35  22   9
  55  42  29  16   3
62  49  36  23  10
  56  43  30  17   4
63  50  37  24  11
  57  44  31  18   5

 b   b   b   b   b
  b   b   b   b   b
 b   b   b   b   b
  b   b   b   b   b
 b   b   b   b   b
  .   .   .   .   .
 .   .   .   .   .
  w   w   w   w   w
 w   w   w   w   w
  w   w   w   w   w
 w   w   w   w   w
  w   w   w   w   w

Searching to nominal depth=9

perft[ 1/ 0.0] =            9 leafs,           1 nodes,   0.00s,  0.00 Mnps
perft[ 2/ 0.9] =           81 leafs,          10 nodes,   0.00s,  0.01 Mnps
perft[ 3/ 1.9] =          658 leafs,          91 nodes,   0.00s,  0.09 Mnps
perft[ 4/ 2.9] =         4265 leafs,         749 nodes,   0.00s,  0.75 Mnps
perft[ 5/ 3.8] =        27117 leafs,        5014 nodes,   0.00s,  5.01 Mnps
perft[ 6/ 4.8] =       167140 leafs,       32131 nodes,   0.02s,  2.01 Mnps
perft[ 7/ 5.8] =      1049442 leafs,      199271 nodes,   0.06s,  3.11 Mnps
perft[ 8/ 6.8] =      6483961 leafs,     1248713 nodes,   0.38s,  3.32 Mnps
perft[ 9/ 7.8] =     41291394 leafs,     7732674 nodes,   2.28s,  3.39 Mnps
End of program.

AartBik
Posts: 103
Joined: Wed Mar 11, 2009 01:30
Location: Mountain View
Contact:

Re: Perft on rectangular boards

Post by AartBik » Sat Nov 13, 2010 21:44

Impressive to see that your code is able to handle so many different variants of checkers. Nice work. Do you have any plans to release an Android application (with either a Java port or using the NDK)? It would be nice to have an app that can play several different checkers variants.

Rein Halbersma
Posts: 1722
Joined: Wed Apr 14, 2004 16:04
Contact:

Re: Perft on rectangular boards

Post by Rein Halbersma » Sun Nov 14, 2010 13:31

AartBik wrote:Impressive to see that your code is able to handle so many different variants of checkers. Nice work. Do you have any plans to release an Android application (with either a Java port or using the NDK)? It would be nice to have an app that can play several different checkers variants.
Hi Aart,

As a proud owner of an Android phone, I certainly plan to release my engine <Mistral> for that platform. However, GUI building is a skill I never tried my hand at so it might take quite a while before I'm ready for release. On the other hand, if you could hack up a GUI for 10x10 draughts like you did for chess with pluggable engine support, that would give me a big incentive to look into this more quickly.

Rein

Ed Gilbert
Posts: 859
Joined: Sat Apr 28, 2007 14:53
Real name: Ed Gilbert
Location: Morristown, NJ USA
Contact:

Re: Perft on rectangular boards

Post by Ed Gilbert » Sun Nov 14, 2010 14:18

On the other hand, if you could hack up a GUI for 10x10 draughts like you did for chess with pluggable engine support, that would give me a big incentive to look into this more quickly.
Indeed, and similarly if there was an open source Windows user interface for draughts, something like Winboard/Xboard for chess, I think there would be many more draughts engines.

-- Ed

BertTuyt
Posts: 1592
Joined: Wed Sep 01, 2004 19:42

Re: Perft on rectangular boards

Post by BertTuyt » Sun Nov 14, 2010 17:11

Ed/Rein,

basically both the GUI's of Damage and Dragon are designed to operate with external engines. I started to define the protocols for this based on the WinBoard/Xboard system.
It is called GUIDE (Graphical User Interface Draughts Engines).
Initially both the GUI of Dragon and Damage were based on GUIDE, although I'm sure we mixed some own ideas so that interchangeability might be an issue nowadays.
You can still download for free the Damage (and Dragon ) GUI.
Also for those who are interested I can sent the GUIDE document.
And last but not least, for people who want to work/improve/ or standardize the Damage GUI, I am more then willing to put all sources also on the Internet.

With kind regards,

Bert

AartBik
Posts: 103
Joined: Wed Mar 11, 2009 01:30
Location: Mountain View
Contact:

Re: Perft on rectangular boards

Post by AartBik » Mon Nov 15, 2010 01:42

BertTuyt wrote: It is called GUIDE (Graphical User Interface Draughts Engines).
Bert,
Can you please post the GUIDE "standard" in this forum, or send me the information by email?

AartBik
Posts: 103
Joined: Wed Mar 11, 2009 01:30
Location: Mountain View
Contact:

Re: Perft on rectangular boards

Post by AartBik » Mon Nov 15, 2010 02:52

Rein Halbersma wrote:On the other hand, if you could hack up a GUI for 10x10 draughts like you did for chess with pluggable engine support, that would give me a big incentive to look into this more quickly.
I am intrigued by the idea, as I enjoyed implementing the UCI support for Chess for Android (http://www.aartbik.com/MISC/uchess.html). If I can find the time, the 10x10 checkers GUI may look something like this.
Attachments
sample.png
sample.png (93.91 KiB) Viewed 7522 times

Rein Halbersma
Posts: 1722
Joined: Wed Apr 14, 2004 16:04
Contact:

Re: Perft on rectangular boards

Post by Rein Halbersma » Mon Nov 15, 2010 08:09

I've created another thread for the GUI discussion to keep this thread to the original topic.

Post Reply