Engines playing Musketeer Chess, good price

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: Engines playing Musketeer Chess, good price

Post by Daniel Shawul »

I fixed perft(3) for the hard position but i still can't get perft(4).
Here is an example where mine differs from you. Can you do a breakdown of perft(3) for this postion ?

Code: Select all

perf(3) for position:    c******l/r1b1kb1r/1p3ppp/p1N2n2/1B1q4/8/1N1p4/PP1P1PPP/R1BQK2R/C******L w KQkq - 1 13

a7b6  1143
b8c7  938
d6b6  1004
d6c7  697
d6b4  832
d6f4  841
g8g7  1000
g8g6  959
h8h7  1000
h8h6  979
a7a6  970
b8b7  960
e9d8  889
d6d7  899
d6d8  862
d6d9  800
d6d5  954
d6e6  137
d6f6  882
d6g6  931
d6h6  870
d6c6  929
d6e7  115
d6e5  151
d6c5  919
a9a8  980
a9b9  979
h9g9  958
c9d8  1199
c9e7  1032
c9f6  1002
c9g5  1040
c9h4  989
f9e8  1098
f9d7  1104
f9c6  1029
f9b5  1113
f9a4  1018
f7d8  1044
f7h6  928
f7g9  950
f7e5  1057
f7g5  946
nodes 39127
Stockfish also seems to have a proplem with the third position. Atleast you and I agree on perft(3) there.
I may have made a mistake on how to setup stockfish for the position though.

Code: Select all

position fen r1b1kb1r/1p3ppp/p1N2n2/1B1q4/8/1N1p4/PP1P1PPP/R1BQK2R[C-L-c-l-] w KQkq - 1 13
d

 +---+---+---+---+---+---+---+---+
 | r |   | b |   | k | b |   | r |
 +---+---+---+---+---+---+---+---+
 |   | p |   |   |   | p | p | p |
 +---+---+---+---+---+---+---+---+
 | p |   | N |   |   | n |   |   |
 +---+---+---+---+---+---+---+---+
 |   | B |   | q |   |   |   |   |
 +---+---+---+---+---+---+---+---+
 |   |   |   |   |   |   |   |   |
 +---+---+---+---+---+---+---+---+
 |   | N |   | p |   |   |   |   |
 +---+---+---+---+---+---+---+---+
 | P | P |   | P |   | P | P | P |
 +---+---+---+---+---+---+---+---+
 | R |   | B | Q | K |   |   | R |
 +---+---+---+---+---+---+---+---+

Fen: r1b1kb1r/1p3ppp/p1N2n2/1B1q4/8/1N1p4/PP1P1PPP/R1BQK2R[C-L-c-l-] w KQkq - 1 13
Key: 1359BBB9217C0D38
Checkers: 
go perft 2
a2a3: 44
f2f3: 43
g2g3: 45
h2h3: 44
a2a4: 44
f2f4: 44
g2g4: 44
h2h4: 44
c6b4: 8
c6d4: 8
c6a5: 8
c6e5: 8
c6a7: 8
c6e7: 8
c6b8: 8
c6d8: 8
b3d4: 45
b3a5: 44
b3c5: 41
b5d3: 46
b5a4: 45
b5c4: 44
b5a6: 46
a1b1: 44
h1f1: 44
h1g1: 44
d1c2: 45
d1e2: 8
d1f3: 43
d1g4: 42
d1h5: 43
e1f1: 44
e1g1: 44

Nodes searched: 1128

go perft 3
a2a3: 1326
f2f3: 1177
g2g3: 1281
h2h3: 1328
a2a4: 1328
f2f4: 1318
g2g4: 1182
h2h4: 1366
c6b4: 245
c6d4: 247
c6a5: 221
c6e5: 269
c6a7: 223
c6e7: 247
c6b8: 229
c6d8: 233
b3d4: 1611
b3a5: 1448
b3c5: 1558
b5d3: 1718
b5a4: 1200
b5c4: 1353
b5a6: 1387
a1b1: 1364
h1f1: 1241
h1g1: 1285
d1c2: 1441
d1e2: 283
d1f3: 1575
d1g4: 1787
d1h5: 1659
e1f1: 1383
e1g1: 1338

Nodes searched: 35851

go perft 4         
a2a3: 45547
f2f3: 39037
g2g3: 44017
h2h3: 45614
a2a4: 45537
f2f4: 44908
g2g4: 39259
h2h4: 47194
c6b4: 8694
c6d4: 8932
c6a5: 7817
c6e5: 9513
c6a7: 7971
c6e7: 8432
c6b8: 8230
c6d8: 8486
b3d4: 59020
b3a5: 51551
b3c5: 52811
b5d3: 75256
b5a4: 39874
b5c4: 55818
b5a6: 61001
a1b1: 47231
h1f1: 41864
h1g1: 43760
d1c2: 52389
d1e2: 8475
d1f3: 52267
d1g4: 58895
d1h5: 55824
e1f1: 46250
e1g1: 42912

Nodes searched: 1264386

Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: Engines playing Musketeer Chess, good price

Post by Daniel Shawul »

Nevermind I fed stockfish the wrong FEN -- I did not understand the musketeer placement format. I should be able to debug my perft now using stockfish.

Code: Select all

position fen r1b1kb1r/1p3ppp/p1N2n2/1B1q4/8/1N1p4/PP1P1PPP/R1BQK2R[CaLhcalh] w KQkq - 1 13
d

 +---+---+---+---+---+---+---+---+
 | r |   | b |   | k | b |   | r |
 +---+---+---+---+---+---+---+---+
 |   | p |   |   |   | p | p | p |
 +---+---+---+---+---+---+---+---+
 | p |   | N |   |   | n |   |   |
 +---+---+---+---+---+---+---+---+
 |   | B |   | q |   |   |   |   |
 +---+---+---+---+---+---+---+---+
 |   |   |   |   |   |   |   |   |
 +---+---+---+---+---+---+---+---+
 |   | N |   | p |   |   |   |   |
 +---+---+---+---+---+---+---+---+
 | P | P |   | P |   | P | P | P |
 +---+---+---+---+---+---+---+---+
 | R |   | B | Q | K |   |   | R |
 +---+---+---+---+---+---+---+---+

Fen: r1b1kb1r/1p3ppp/p1N2n2/1B1q4/8/1N1p4/PP1P1PPP/R1BQK2R[CaLhcalh] w KQkq - 1 13
Key: E2CDA50E96A0BF63
Checkers: 
go perft 1
a2a3: 1
f2f3: 1
g2g3: 1
h2h3: 1
a2a4: 1
f2f4: 1
g2g4: 1
h2h4: 1
c6b4: 1
c6d4: 1
c6a5: 1
c6e5: 1
c6a7: 1
c6e7: 1
c6b8: 1
c6d8: 1
b3d4: 1
b3a5: 1
b3c5: 1
b5d3: 1
b5a4: 1
b5c4: 1
b5a6: 1
a1b1: 1
h1f1: 1
h1g1: 1
d1c2: 1
d1e2: 1
d1f3: 1
d1g4: 1
d1h5: 1
e1f1: 1
e1g1: 1

Nodes searched: 33

go perft 2
a2a3: 44
f2f3: 43
g2g3: 45
h2h3: 44
a2a4: 44
f2f4: 44
g2g4: 44
h2h4: 44
c6b4: 8
c6d4: 8
c6a5: 8
c6e5: 8
c6a7: 8
c6e7: 8
c6b8: 8
c6d8: 8
b3d4: 45
b3a5: 44
b3c5: 41
b5d3: 46
b5a4: 45
b5c4: 44
b5a6: 46
a1b1: 44
h1f1: 44
h1g1: 44
d1c2: 45
d1e2: 8
d1f3: 43
d1g4: 42
d1h5: 43
e1f1: 44
e1g1: 44

Nodes searched: 1128

go perft 3
a2a3: 1326
f2f3: 1177
g2g3: 1281
h2h3: 1328
a2a4: 1328
f2f4: 1318
g2g4: 1182
h2h4: 1366
c6b4: 245
c6d4: 247
c6a5: 221
c6e5: 269
c6a7: 223
c6e7: 247
c6b8: 229
c6d8: 233
b3d4: 1611
b3a5: 1448
b3c5: 1558
b5d3: 1718
b5a4: 1200
b5c4: 1353
b5a6: 1387
a1b1: 1365
h1f1: 1242
h1g1: 1286
d1c2: 1441
d1e2: 283
d1f3: 1575
d1g4: 1787
d1h5: 1659
e1f1: 1383
e1g1: 1339

Nodes searched: 35855

go perft 4
a2a3: 45597
f2f3: 39081
g2g3: 44065
h2h3: 45664
a2a4: 45587
f2f4: 44958
g2g4: 39303
h2h4: 47246
c6b4: 8694
c6d4: 8932
c6a5: 7817
c6e5: 9513
c6a7: 7971
c6e7: 8432
c6b8: 8230
c6d8: 8486
b3d4: 59084
b3a5: 51611
b3c5: 52883
b5d3: 75342
b5a4: 39914
b5c4: 55888
b5a6: 61192
a1b1: 47325
h1f1: 41931
h1g1: 43829
d1c2: 52445
d1e2: 8475
d1f3: 52327
d1g4: 58970
d1h5: 55891
e1f1: 46298
e1g1: 42979

Nodes searched: 1265960

Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Engines playing Musketeer Chess, good price

Post by Ferdy »

Daniel Shawul wrote: Wed Jan 15, 2020 5:13 am Nevermind I fed stockfish the wrong FEN -- I did not understand the musketeer placement format. I should be able to debug my perft now using stockfish.
All right, so far so good got a match with SF.
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: Engines playing Musketeer Chess, good price

Post by Daniel Shawul »

Ferdy wrote: Wed Jan 15, 2020 5:26 am
Daniel Shawul wrote: Wed Jan 15, 2020 5:13 am Nevermind I fed stockfish the wrong FEN -- I did not understand the musketeer placement format. I should be able to debug my perft now using stockfish.
All right, so far so good got a match with SF.
Found my bug, it is yet another one with rank 0 and 9 being part of the board. The musketeers were being captured directly before they get into play.
Earlier it was them getting into play by themselves ... perfect demonstration why they should be considered holdings :)

The 8x10 board is really a very bad design.
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Engines playing Musketeer Chess, good price

Post by Ferdy »

hgm wrote: Tue Jan 14, 2020 5:41 pm The WinBoard-AA package now contains a WinBoard version that no longer needs a gating suffix to the move in holdingless Seirawan. WinBoard already had code that made it resistant to missing promotion characters, supplying a default in that case (usually Q). So I just had to make the legality test recognizing first-rank moves with something behind it as a promotion. The promotion character was not as insignificant as I thought, so I now set it to the piece behind it, in a bit of a kludgy way. (It would not work with an odd number of ranks.) But for now that should do.

It will still add a gating suffix in the moves it sends to the engine.
Thanks for the update.

I have not implemented yet the PS and GP phases, what I do is trying to support pasting of fen after PS and GP phases.
On winboard/engine communication, upon receiving the position via setboard,

Code: Select all

10565 >first : setboard f******l/rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR/F******L w KQkq - 0 1
I just sent back the full piece_to_char and the fen that I received, followed by the piece id's.

Code: Select all

10684 <first : setup (PNBRQ.E....C.AF.MH.SU........D............LKpnbrq.e....c.af.mh.su........d............lk) 8x10+0_seirawan f******l/rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR/F******L w KQkq - 0 1

Code: Select all

10685 <first : piece L& NB2
10685 <first : piece C& llNrrNDK
10685 <first : piece E& KDA
10685 <first : piece U& CN
10685 <first : piece S& B2DN
10686 <first : piece D& QN
10686 <first : piece F& B3DfNbN
10686 <first : piece M& NR
10686 <first : piece A& NB
10686 <first : piece H& DHAG
10686 <first : piece K& KisO2
I detect the musketeer pieces selected thru the fen (in all ranks) that I received. It should work after PS and GP.

Perhaps I will not send the piece id definitions because when I receive

Code: Select all

10563 >first : variant musketeer
before setboard, I send setup and piece id's

Code: Select all

setup (PNBRQ.E....C.AF.MH.SU........D............LKpnbrq.e....c.af.mh.su........d............lk) 8x10+0_seirawan *c****l*/rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR/*C****L* w KQBCDFGkqbcdfg - 0 1

Code: Select all

10658 <first : piece L& NB2
10658 <first : piece C& llNrrNDK
10658 <first : piece E& KDA
10659 <first : piece U& CN
10659 <first : piece S& B2DN
10659 <first : piece D& QN
10659 <first : piece F& B3DfNbN
10659 <first : piece M& NR
10659 <first : piece A& NB
10659 <first : piece H& DHAG
10659 <first : piece K& KisO2
That fen is my default.

Code: Select all

*c****l*/rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR/*C****L* w KQBCDFGkqbcdfg - 0 1
In any case it is working so far.
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Engines playing Musketeer Chess, good price

Post by Ferdy »

hgm wrote: Tue Jan 14, 2020 5:41 pm The WinBoard-AA package now contains a WinBoard version that no longer needs a gating suffix to the move in holdingless Seirawan. WinBoard already had code that made it resistant to missing promotion characters, supplying a default in that case (usually Q). So I just had to make the legality test recognizing first-rank moves with something behind it as a promotion. The promotion character was not as insignificant as I thought, so I now set it to the piece behind it, in a bit of a kludgy way. (It would not work with an odd number of ranks.) But for now that should do.

It will still add a gating suffix in the moves it sends to the engine.
There is an issue in sending a move to the engine. Gating suffix is not required but winboard sent a move with suffix.

KingSlayer(first) - aiM(second)

White to play and played,

Code: Select all

131764 <first : move c1c3
Image

Then winboad sent

Code: Select all

131764 >second: c1c3f
and was correctly rejected as illegal.

Code: Select all

131873 <second: Error (Illegal move): c1c3f
User avatar
musketeerchess
Posts: 161
Joined: Sun Apr 21, 2013 2:02 pm
Location: Paris, France

Re: Engines playing Musketeer Chess, good price

Post by musketeerchess »

Daniel Shawul wrote: Tue Jan 14, 2020 5:58 pm @Ferd
I get the first perft all correct.

The second one is wrong after and including perft(3)

The third one I miss it all. I thought you can gate whether the Knight becomes pinned or not.

Is there a complete list of all the rules of musketeer chess ? The official webpage I am sure
does not have this pinning rule.
Hi Daniel
Musketeer Chess is like chess. So pinned pieces cannot move when it’s a king tha could be in check even though there willmsupposedly a gated piece can obstruct the check, but the pin is a pin like in classic chess.

Inwill add this to the current rules. It’s a rare situation but can happen so there is for clarification here.
inventor of Musketeer Chess. A modern commercial chess variant.

www.musketeerchess.net

Pieces are available on Houseofstaunton.com or Paypal
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Engines playing Musketeer Chess, good price

Post by Ferdy »

Position for perft with early promotion possibilties even when musketeer pieces (dragon[QN] and chancellor[RN]) are still not gated.
Main position is taken from position 5 from https://www.chessprogramming.org/Perft_Results

Features:
* When pawn promotes, black's dragon at c file, loses the right to gate.
* When pawn promotes to either dragon or chancellor or queen or rook, the black queen is partially pinned and could not move vertically.

Image

Code: Select all

**d****m/rnbq1k1r/pp1Pbppp/2p5/8/2B5/8/PPP1NnPP/RNBQK2R/D******M w KQ - 0 1
Perft 5

Code: Select all

1, 46
2, 1548
3, 68041
4, 2260505
5, 101373662
Perft divide 5

Code: Select all

   g2g3 : 1937111
   g2g4 : 1991717
   b2b3 : 2069943
   b2b4 : 2158541
   c2c3 : 2273194
   h2h3 : 2098192
   h2h4 : 2198380
   a2a3 : 2103260
   a2a4 : 2275642
  d7c8n : 2528247
  d7c8b : 2718335
  d7c8r : 1632064
  d7c8m : 1937062
  d7c8q : 2110149
  d7c8d : 2311562
   b1d2 : 1600601
   b1a3 : 1935389
   b1c3 : 2376836
   e2g1 : 2197031
   e2c3 : 2661452
   e2g3 : 2477889
   e2d4 : 2534777
   e2f4 : 2453160
   c1d2 : 2066738
   c1e3 : 2676095
   c1f4 : 2565869
   c1g5 : 2204465
   c1h6 : 1890534
   c4b3 : 1840814
   c4d3 : 1827271
   c4b5 : 1994656
   c4d5 : 2106166
   c4a6 : 1791438
   c4e6 : 2257074
   c4f7 : 1970845
  h1f1m : 2254483
  h1g1m : 2032070
   d1d2 : 2292418
   d1d3 : 2997669
   d1d4 : 3130634
   d1d5 : 2950374
   d1d6 : 2382483
   e1f1 : 2343760
   e1d2 : 1095190
   e1f2 : 1791129
  e1g1m : 2330953
 LeafNodes : 101373662
 
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: Engines playing Musketeer Chess, good price

Post by Daniel Shawul »

I have fixed all bugs including pinned pieces and promotions and now it matches all your perfts.

I still don't like the pinned piece logic though -- it means gating is not really uncovering a piece.

Also since I allow king captures (and do not check legality of move beforehand) in, pinning was a bit of a pain to handle.

Thanks!
User avatar
gbtami
Posts: 389
Joined: Wed Sep 26, 2012 1:29 pm
Location: Hungary

Re: Engines playing Musketeer Chess, good price

Post by gbtami »

Daniel Shawul wrote: Thu Jan 16, 2020 4:49 pm I have fixed all bugs including pinned pieces and promotions and now it matches all your perfts.

I still don't like the pinned piece logic though -- it means gating is not really uncovering a piece.

Also since I allow king captures (and do not check legality of move beforehand) in, pinning was a bit of a pain to handle.

Thanks!
This is the same logic you can see in castling rules. While in the final position after you moved your king and rook may be safe, castling trough check is prohibited.