perft counts for XiangQi ?

Discussion of chess software programming and technical issues.

Moderator: Ras

User avatar
hgm
Posts: 28361
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

perft counts for XiangQi ?

Post by hgm »

Can a list of perft(N) values be found somewhere for XiangQi positions?

I have made a XQ engine now with a move generator that is quite error prone, using separate lists of move directions for each board square, (so typos in the list for one particular square could go unnoticed for a long time). This is a very convenient way in XQ to implement the confinement of pieces to their own board zone, by simply leaving out all the moves from a given square that could cross the zone boundary, as it saves work on board edges at the same time, so it is really a win-win method. But alas, with a lot of potential to hide errors, so a method for exhaustive testing, such as perft, would really come in handy!
Dann Corbit
Posts: 12781
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: perft counts for XiangQi ?

Post by Dann Corbit »

hgm wrote:Can a list of perft(N) values be found somewhere for XiangQi positions?

I have made a XQ engine now with a move generator that is quite error prone, using separate lists of move directions for each board square, (so typos in the list for one particular square could go unnoticed for a long time). This is a very convenient way in XQ to implement the confinement of pieces to their own board zone, by simply leaving out all the moves from a given square that could cross the zone boundary, as it saves work on board edges at the same time, so it is really a win-win method. But alas, with a lot of potential to hide errors, so a method for exhaustive testing, such as perft, would really come in handy!
I guess that the best bet is hoichess.

These are the Xiangqui projects I have:
cxboard-0.14
eleeye
hoichess
hox_Project
junfa-0.0.2
JXiangQi
mrsd-v0.2
palmxq
qipan-0.0.2
tsito-0.8.4
vbchess
wizard
xiangqi-chess
xqgb
xqwizard

I do not see the string 'perft' in any of them.
User avatar
hgm
Posts: 28361
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: perft counts for XiangQi ?

Post by hgm »

You are collecting them? :shock:

If so, you might be interested to know about the following WinBoard engines:

MaxQi (a micro-Max derivative, so open source)
TJxiangqi (a TJchess derivative, only available as Windows executable)

I furthermore wrote an adapter to play Qianhong plugins as engines under WinBoard. (see http://www.jcraner.com/qianhong/forum/v ... c.php?t=63 ) Interesting amongst the Qianhong plugins (next to eleeye which you already mention) is:
VSCCP (open source, website seems to be down, but still obtainable from the Qianhong website.)

But, like you say, no luck with perft yet... I will have a look to see if hoixiangqi supports it.
TonyJH
Posts: 183
Joined: Tue Jun 20, 2006 4:41 am
Location: USA

Re: perft counts for XiangQi ?

Post by TonyJH »

TJxiangqi debug version supports perft. I can send you a version that supports perft, or you can send me the positions (fen) you're interested in. I have perft results here. Here's what I get for the starting position:

ply=1, positions=44
ply=2, positions=1920
ply=3, positions=79666
ply=4, positions=3290240
ply=5, positions=133312995
ply=6, positions=5392831844
User avatar
abik
Posts: 823
Joined: Fri Dec 01, 2006 10:46 pm
Location: Mountain View, CA, USA
Full name: Aart Bik

Re: perft counts for XiangQi ?

Post by abik »

I am also a proponent of extending the use of perft beyond chess (checkers, reversi, etc). I have added a link to your page on the Chess Wiki page http://chessprogramming.wikispaces.com/Perft in an attempt to centralize this information somewhat. Feel free to add more!
User avatar
hgm
Posts: 28361
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: perft counts for XiangQi ?

Post by hgm »

OK, thnks for the numbers. It works upto perft(5) now. (Of course I had forgotte the King-facing rule...) Perft(6) is a bit slow, as I have not implemented an efficient test for King capture yet, so I really have to do a pseudo-legal perft(7) to find the legal perft(6). So it will taka a few hours before I can compare it.
Dann Corbit
Posts: 12781
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: perft counts for XiangQi ?

Post by Dann Corbit »

hgm wrote:You are collecting them? :shock:

If so, you might be interested to know about the following WinBoard engines:

MaxQi (a micro-Max derivative, so open source)
TJxiangqi (a TJchess derivative, only available as Windows executable)

I furthermore wrote an adapter to play Qianhong plugins as engines under WinBoard. (see http://www.jcraner.com/qianhong/forum/v ... c.php?t=63 ) Interesting amongst the Qianhong plugins (next to eleeye which you already mention) is:
VSCCP (open source, website seems to be down, but still obtainable from the Qianhong website.)

But, like you say, no luck with perft yet... I will have a look to see if hoixiangqi supports it.
I was missing MaxQui.
Thanks.
User avatar
hgm
Posts: 28361
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: perft counts for XiangQi ?

Post by hgm »

TonyJH wrote:TJxiangqi debug version supports perft. I can send you a version that supports perft, or you can send me the positions (fen) you're interested in. I have perft results here. Here's what I get for the starting position:

ply=1, positions=44
ply=2, positions=1920
ply=3, positions=79666
ply=4, positions=3290240
ply=5, positions=133312995
ply=6, positions=5392831844
OK, perft(6) also checks out. But what I really need to completely validate my move generator is the perft of a tree that tries every piece on every square it can get to. (Preferably with and without blocking.) From the opening even perft(6) is a long way from trying a black Horse in a white corner.

Can TJxiangqi handle positions without Kings? If so, I would be intested to have deep perfts (like perft(10) or better) for positions like

9/9/9/9/4h4/4H4/9/9/9/9 w 0 1
9/9/9/9/4h4/9/4P4/9/9/9 w 0 1
9/9/9/4p4/9/4H4/9/9/9/9 w 0 1
9/9/9/6p2/9/9/2P6/9/9/9 w 0 1
9/9/4e4/9/4H4/9/9/9/9/9 w 0 1
9/9/9/9/4h4/99//4E4/9/9 w 0 1

Also interesting to have (put probably limited to lower depth) would be

r7c/9/9/9/9/9/9/9/9/4R4 w 0 1
4r4/9/9/9/9/9/9/9/9/R7C w 0 1

Kings could be added on d0 and f9 to make the positions legal, but I am afraid that this would drive up the branching ratio to more than could be handled for a depth where the pieces have probed the entire board. Although the King-facing rule tends to limit the number. With Kings the FENs would be:

5k3/9/9/9/4h4/4H4/9/9/9/3K5 w 0 1
5k3/9/9/9/4h4/9/4P4/9/9/3K5 w 0 1
5k3/9/9/4p4/9/4H4/9/9/9/3K5 w 0 1
5k3/9/9/6p2/9/9/2P6/9/9/3K5 w 0 1
5k3/9/4e4/9/4H4/9/9/9/9/3K5 w 0 1
5k3/9/9/9/4h4/9/9/4E4/9/3K5 w 0 1
r4k2c/9/9/9/9/9/9/9/9/4RK3 w 0 1
4rk3/9/9/9/9/9/9/9/9/R2K4C w 0 1
TonyJH
Posts: 183
Joined: Tue Jun 20, 2006 4:41 am
Location: USA

Re: perft counts for XiangQi ?

Post by TonyJH »

I can try some of those positions tonight.
TonyJH
Posts: 183
Joined: Tue Jun 20, 2006 4:41 am
Location: USA

Re: perft counts for XiangQi ?

Post by TonyJH »

I ran the positions with kings, since TJxiangqi doesn't handle positions without kings correctly. I don't guarantee my results are all correct. Note that the kings are facing each other in the second to last position. :)

Code: Select all

5k3/9/9/9/4h4/4H4/9/9/9/3K5 w 0 1
ply=1, positions=8
ply=2, positions=76
ply=3, positions=741
ply=4, positions=7014
ply=5, positions=56762
ply=6, positions=461735
ply=7, positions=3856123
ply=8, positions=32046709

5k3/9/9/9/4h4/9/4P4/9/9/3K5 w 0 1
ply=1, positions=3
ply=2, positions=28
ply=3, positions=92
ply=4, positions=872
ply=5, positions=3060
ply=6, positions=25382
ply=7, positions=94145
ply=8, positions=808738
ply=9, positions=3230822
ply=10, positions=25815173

5k3/9/9/4p4/9/4H4/9/9/9/3K5 w 0 1
ply=1, positions=10
ply=2, positions=30
ply=3, positions=292
ply=4, positions=958
ply=5, positions=8095
ply=6, positions=28578
ply=7, positions=247542
ply=8, positions=926886
ply=9, positions=7526814
ply=10, positions=30288116

5k3/9/9/6p2/9/9/2P6/9/9/3K5 w 0 1
ply=1, positions=3
ply=2, positions=8
ply=3, positions=25
ply=4, positions=77
ply=5, positions=259
ply=6, positions=870
ply=7, positions=3214
ply=8, positions=11923
ply=9, positions=49967
ply=10, positions=211061
ply=11, positions=951046
ply=12, positions=4280583

5k3/9/4e4/9/4H4/9/9/9/9/3K5 w 0 1
ply=1, positions=10
ply=2, positions=57
ply=3, positions=563
ply=4, positions=2307
ply=5, positions=20102
ply=6, positions=90925
ply=7, positions=757615
ply=8, positions=3195714
ply=9, positions=26796889

5k3/9/9/9/4h4/9/9/4E4/9/3K5 w 0 1
ply=1, positions=6
ply=2, positions=60
ply=3, positions=267
ply=4, positions=2532
ply=5, positions=11620
ply=6, positions=97144
ply=7, positions=418280
ply=8, positions=3558887
ply=9, positions=15724304

r4k2c/9/9/9/9/9/9/9/9/4RK3 w 0 1
ply=1, positions=0
ply=2, positions=0
ply=3, positions=0
ply=4, positions=0
ply=5, positions=0
ply=6, positions=0

4rk3/9/9/9/9/9/9/9/9/R2K4C w 0 1
ply=1, positions=25
ply=2, positions=340
ply=3, positions=8302
ply=4, positions=138895
ply=5, positions=3681340
ply=6, positions=61845133