Duck Chess

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

rgrosz789
Posts: 121
Joined: Sat Dec 03, 2022 9:28 pm
Full name: Rick Groszkiewicz

Re: Duck Chess

Post by rgrosz789 »

Thanks for that - now I was able to load Mayhemduck21 with the debug switch - but it did not fail again!

I modified the engine list, so I could get it to play both sides of a duck chess game. Unfortunately, it still thinks that it can put my King in check, which leads to the loss of three pieces by move eight.

Image

Image
Retired actuary and software developer. I love chess, coffee, wine and food
rgrosz789
Posts: 121
Joined: Sat Dec 03, 2022 9:28 pm
Full name: Rick Groszkiewicz

Re: Duck Chess

Post by rgrosz789 »

hgm wrote: Sun Mar 26, 2023 9:00 am You need an extra level of quoting. Otherwise the debug 1 will be interpreted as arguments to uci2wb (or in your second case, as options for XBoard), rather than to mayhemduck. So

xboard -fcp "uci2wb \"mayhemduck debug 1\"" -variant duck
I had success with mayhemduck21 on two machines running linux Mint. But I could not get mayhemduck21 to run (or create a debug file) on a third machine running debian.

Here's the xboard debug output when I tried loading mayhemduck21:

locale = en_US.UTF-8
recognized 'normal' (-1) as variant normal
recognized 'normal' (-1) as variant normal
recognized 'normal' (-1) as variant normal
shuffleOpenings = 0
shuffleOpenings = 0
Version: xboard 4.9.1 + fairymax ()
Reset(1, 0) from gameMode 0
recognized 'normal' (-1) as variant normal
GameEnds(0, (null), 2)
shuffleOpenings = 0
StartChildProcess (dir=".") fairymax
400 >first : xboard
protover 2
414 <first : /usr/games/fairymax: 1: Syntax error: "(" unexpected
Unload first
StartChildProcess (dir=".") uci2wb mayhemduck
26753 >first : xboard
protover 2
Reset(1, 1) from gameMode 0
recognized 'duck' (-1) as variant duck
GameEnds(0, (null), 2)
26753 >first : force
shuffleOpenings = 0
26758 >first : new
random
26758 >first : variant duck
26758 >first : level 40 5 0
26758 >first : post
26758 >first : hard
Impossible move , type = 0
26758 <first : feature setboard=1 usermove=1 debug=1 ping=1 name=1 reuse=0 exclude=1 pause=1 sigint=0 sigterm=0 done=0
26758 >first : accepted setboard
26758 >first : accepted usermove
26758 >first : accepted debug
26758 >first : accepted ping
26758 >first : accepted name
26758 >first : accepted reuse
26759 >first : accepted exclude
26759 >first : accepted pause
26759 >first : accepted sigint
26759 >first : accepted sigterm
26759 >first : accepted done
26759 <first : feature option="UCI2WB debug output -check 0"
26759 >first : accepted option
26759 <first : feature option="ponder always -check 0"
26759 >first : accepted option
26763 <first : tellusererror UCI2WB: mayhemduck died on me
GameEnds(30, xboard exit, 2)
Retired actuary and software developer. I love chess, coffee, wine and food
User avatar
hgm
Posts: 27870
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Duck Chess

Post by hgm »

The error message is what UCI2WB says whan the engine process that it has launched unexpectedly terminates. So the problem is with mayhemduck: it either failed to start, or crashed. If you want to have more information on the exact moment where mayhemduck failed, you should run UCI2WB also in debug mode; you can do this by chanching the XBoard engine option to

-fcp "uci2wb debug mayhemduck"

And repeating what you did. The commands that are exchanged between UCI2WB and the engine will then also be reported in the xboard.debug file. (Currently it only contains what goes on between XBoard and UCI2WB.)
rgrosz789
Posts: 121
Joined: Sat Dec 03, 2022 9:28 pm
Full name: Rick Groszkiewicz

Re: Duck Chess

Post by rgrosz789 »

This time I tried using
xboard -debug -fcp "uci2wb \"mayhemduck debug 1\"" -variant duck

and it gave me less information in xboard.debug:

locale = en_US.UTF-8
recognized 'duck' (-1) as variant duck
recognized 'duck' (-1) as variant duck
recognized 'duck' (-1) as variant duck
shuffleOpenings = 0
shuffleOpenings = 0
Version: xboard 4.9.1 + uci2wb ()
Reset(1, 0) from gameMode 0
recognized 'duck' (-1) as variant duck
GameEnds(0, (null), 2)
shuffleOpenings = 0
StartChildProcess (dir=".") uci2wb "mayhemduck debug 1"
449 >first : xboard
protover 2
451 <first : feature setboard=1 usermove=1 debug=1 ping=1 name=1 reuse=0 exclude=1 pause=1 sigint=0 sigterm=0 done=0
451 >first : accepted setboard
451 >first : accepted usermove
451 >first : accepted debug
451 >first : accepted ping
451 >first : accepted name
451 >first : accepted reuse
451 >first : accepted exclude
451 >first : accepted pause
451 >first : accepted sigint
451 >first : accepted sigterm
451 >first : accepted done
451 <first : feature option="UCI2WB debug output -check 0"
451 >first : accepted option
451 <first : feature option="ponder always -check 0"
451 >first : accepted option
454 <first : tellusererror UCI2WB: mayhemduck debug 1 died on me
GameEnds(30, xboard exit, 2)
Retired actuary and software developer. I love chess, coffee, wine and food
JohnWoe
Posts: 508
Joined: Sat Mar 02, 2013 11:31 pm

Re: Duck Chess

Post by JohnWoe »

I forgot to add "Debug" as an UCI option. Now it works. Disabled by default of course.
There were also lots of little bugs that are now corrected in v2.2.

Also I added a small internal "opening" book to avoid repetition. Can be disabled by OwnBook option.

Code: Select all

const std::unordered_map<std::string, std::string> g_openings = {
  {"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w HAha -",      "e2e4@e6|e2e4@d6|d2d4@e6|d2d4@d6|g1f3@e6|g1f3@d6|b1c3@d6|b1c3@e6"}, // Startpos
  {"rnbqkbnr/pppppppp/4*3/8/4P3/8/PPPP1PPP/RNBQKBNR b HAha e3", "d7d6@d3|g7g6@d3|b7b6@d3"}, // e2e4@e6
  {"rnbqkbnr/pppppppp/3*4/8/4P3/8/PPPP1PPP/RNBQKBNR b HAha e3", "e7e6@e3|g7g6@e3|b7b6@e3"}, // e2e4@d6
  {"rnbqkbnr/pppppppp/4*3/8/3P4/8/PPP1PPPP/RNBQKBNR b HAha d3", "e7e6@d3|g7g6@d3|b7b6@d3"}, // d2d4@e6
  {"rnbqkbnr/pppppppp/3*4/8/3P4/8/PPP1PPPP/RNBQKBNR b HAha d3", "e7e6@e3|g7g6@e3|b7b6@e3"}, // d2d4@d6
  {"rnbqkbnr/pppppppp/4*3/8/8/5N2/PPPPPPPP/RNBQKB1R b HAha -",  "d7d6@e3|g7g6@e3|b7b6@e3"}, // g1f3@e6
  {"rnbqkbnr/pppppppp/3*4/8/8/5N2/PPPPPPPP/RNBQKB1R b HAha -",  "e7e6@e3|g7g6@e3|b7b6@e3"}, // g1f3@d6
  {"rnbqkbnr/pppppppp/4*3/8/8/2N5/PPPPPPPP/R1BQKBNR b HAha -",  "d7d6@e3|g7g6@e3|b7b6@e3"}, // b1c3@e6
  {"rnbqkbnr/pppppppp/3*4/8/8/2N5/PPPPPPPP/R1BQKBNR b HAha -",  "e7e6@e3|g7g6@e3|b7b6@e3"}, // b1c3@d6
  {"rnbqkbnr/pppppppp/4*3/8/8/1P6/P1PPPPPP/RNBQKBNR b HAha -",  "d7d6@e3|g7g6@e3|b7b6@e3"}, // b2b3@e6
  {"rnbqkbnr/pppppppp/3*4/8/8/1P6/P1PPPPPP/RNBQKBNR b HAha -",  "d7d6@e3|g7g6@e3|b7b6@e3"}, // b2b3@d6
  {"rnbqkbnr/pppppppp/4*3/8/8/6P1/PPPPPP1P/RNBQKBNR b HAha -",  "d7d6@e3|g7g6@e3|b7b6@e3"}, // g2g3@e6
  {"rnbqkbnr/pppppppp/3*4/8/8/6P1/PPPPPP1P/RNBQKBNR b HAha -",  "d7d6@e3|g7g6@e3|b7b6@e3"}  // g2g3@d6
};
Xboard works now well. Matches can be played. v2.2 beat v2.1 by 80% score.

Very nice game.
[pgn][Event "Computer Chess Game"]
[Site "desktop"]
[Date "2023.03.27"]
[Round "-"]
[White "MayhemDuck 2.2 (UCI2WB)"]
[Black "MayhemDuck 2.1 (UCI2WB)"]
[Result "1-0"]
[TimeControl "60+3"]
[Variant "duck"]
[Annotator "2. -0,01 1... +0,25"]

1. e4,e6 Nf6,c3 {+0,25/6 5} 2. e5,g4 {-0,01/5 5} Ne4,e6 {+0,22/4 5} 3.
d3,c5 {+0,93/4 5} Ng5,d2 {-2,65/6 5} 4. h4,e6 {+2,32/5 5} Nc6,d6
{-2,83/6 5} 5. Bxg5,b8 {+3,19/4 5} h6,f4 {-1,68/6 5} 6. Qh5,d4 {+2,50/6 5}
hxg5,h6 {-0,68/5 5} 7. Nf3,h7 {+1,08/5 5} gxh4,h6 {-0,97/4 5} 8. Nc3,h7
{+1,96/4 5} e6,h6 {-1,11/4 5} 9. O-O-O,h7 {+2,39/4 5} Bb4,h6 {-0,75/5 5}
10. Qg4,b5 {+1,21/4 5} f5,a1 {+1,95/3 5} 11. Qxg7,h7 {+3,24/5 5} Rf8,a1
{-1,20/3 5} 12. Qg5,f6 {+6,22/4 5} Bxc3,a1 {-0,43/3 4} 13. bxc3,f6
{+5,67/4 5} Qe7,h2 {-1,02/3 4} 14. Qg6,d8 {+2,90/4 4} Qa3,f7 {-0,74/5 4}
15. Rxh4,b2 {+3,16/6 4} Ne7,f7 {-1,37/7 4} 16. Qh6,b2 {+1,72/12 4} Nd5,c4
{-0,92/6 4} 17. Qg6,b2 {+1,15/9 4} Nxc3,f7 {-0,71/9 4} 18. Rh7,b2
{+0,89/8 4} Rf7,g7 {+0,25/8 4} 19. Rh8,b2 {+0,74/8 4} Nxd1,g8 {+0,25/8 4}
20. Kxd1,f8 {+1,06/7 4} Qxa2,g8 {-1,05/7 4} 21. Ng5,f8 {+4,67/8 4} Qa1,g8
{-4,64/10 4} 22. Qxf7,b1 {+3,82/8 4} Kd8,e8 {-5,80/11 4} 23. Qf6,b1
{+5,57/14 4} Ke8,g8 {-13,27/7 4} 24. Kc1,b1 {+5,57/6 4} d6,g8 {-5,89/9 4}
25. Kd2,b1 {+4,71/7 4} Bd7,g8 {-5,59/5 4} 26. Qf7,d8 {+52,42/6 4} Kxf7,d5
{-104,85/5 0,1} 27. Nxf7,b8 {+104,85/1 0,1}
{Xboard adjudication: King destroyed} 1-0
[/pgn]
User avatar
hgm
Posts: 27870
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Duck Chess

Post by hgm »

rgrosz789 wrote: Mon Mar 27, 2023 4:30 pm This time I tried using
xboard -debug -fcp "uci2wb \"mayhemduck debug 1\"" -variant duck

...
That is because this way 'debug' is an option to mayhemduck. To make UCI2WB more talkative, you should give it as an option to UCI2WB, like:

xboard -debug -fcp "uci2wb debug mayhemduck" -variant duck
rgrosz789
Posts: 121
Joined: Sat Dec 03, 2022 9:28 pm
Full name: Rick Groszkiewicz

Re: Duck Chess

Post by rgrosz789 »

JohnWoe wrote: Mon Mar 27, 2023 7:27 pm I forgot to add "Debug" as an UCI option. Now it works. Disabled by default of course.
There were also lots of little bugs that are now corrected in v2.2.
Yes, mayhemduck22 definitely plays better (under linux mint).

But I still can't get it to work on debian.
As a matter of fact, xboard also gives errors for fairyMax at startup - now I wonder if xboard is the problem?!

Contents of xboard.debug:

locale = en_US.UTF-8
recognized 'normal' (-1) as variant normal
recognized 'normal' (-1) as variant normal
recognized 'normal' (-1) as variant normal
shuffleOpenings = 0
shuffleOpenings = 0
Version: xboard 4.9.1 + fairymax ()
Reset(1, 0) from gameMode 0
recognized 'normal' (-1) as variant normal
GameEnds(0, (null), 2)
shuffleOpenings = 0
StartChildProcess (dir=".") fairymax
407 >first : xboard
protover 2
411 <first : /usr/games/fairymax: 1: Syntax error: "(" unexpected
Unload first
StartChildProcess (dir=".") fairymax
17958 >first : xboard
protover 2
Reset(1, 1) from gameMode 0
recognized 'normal' (-1) as variant normal
GameEnds(0, (null), 2)
17959 >first : force
shuffleOpenings = 0
17963 >first : new
random
17963 >first : level 40 5 0
17963 >first : post
17963 >first : hard
Impossible move , type = 0
17964 <first : /usr/games/fairymax: 1: Syntax error: "(" unexpected
recognized 'normal' (-1) as variant normal
18959 >first : new
random
18962 >first : level 40 5 0
18964 >first : post
18967 >first : hard
Impossible move , type = 0
GameEnds(28, Error: first chess program (fairymax) exited unexpectedly, 2)
21663 >first : result 0-1 {Error: first chess program (fairymax) exited unexpectedly}
21663 >first : force
21663 >first : quit
Retired actuary and software developer. I love chess, coffee, wine and food
User avatar
hgm
Posts: 27870
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Duck Chess

Post by hgm »

It doesn't look like it. The process that is supposed to execute Fairy-Max (/usr/games/fairymax) appears to send the line

1: Syntax error: "(" unexpected

to XBoard after it gets launched. Now I am pretty sure that Fairy-Max would never print such a message.

What happens when you start fairymax from the command line, and type

xboard
protover 2

to it?
rgrosz789
Posts: 121
Joined: Sat Dec 03, 2022 9:28 pm
Full name: Rick Groszkiewicz

Re: Duck Chess

Post by rgrosz789 »

Here is the terminal output:

rick@debian:~$ fairymax

tellics say Fairy-Max 5.0b
tellics say by H.G. Muller
xboard
protover 2
feature myname="Fairy-Max 5.0b"
feature memory=1 exclude=1
feature setboard=0 xedit=1 ping=1 done=0
feature variants="normal,nocastle,shatranj,asean,makruk,cambodian,ai-wok,courier,knightmate,capablanca,gothic,janus,falcon,cylinder,berolina,super,seirawan,spartan,great,light-brigade,king-of-the-hill,bifurcator,team-mate,los-alamos,ciccolini,mexican,grande-acedrex,roman,almost-wildebeest,fairy"
feature option="Resign -check 0"
feature option="Resign Threshold -spin 800 200 1200"
feature option="Claim draw after -spin 50 0 200"
feature option="Ini File -file /usr/share/games/fairymax/fmax.ini"
feature option="Multi-PV Margin -spin 0 0 1000"
feature option="Variant fairy selects -combo FIDE-Clobberers /// Clobberers-FIDE /// FIDE-Nutters /// Nutters-FIDE /// Clobberers-Nutters /// Nutters-Clobberers /// FIDE-Rookies /// Rookies-FIDE /// Clobberers-Rookies /// Rookies-Clobberers /// Nutters-Rookies /// Rookies-Nutters"
feature option="Makruk rules -combo makruk /// Cambodian /// Ai-wok"
feature option="Dummy Slider Example -slider 20 0 100"
feature option="Dummy String Example -string happy birthday!"
feature option="Dummy Path Example -path ."
feature option="Automatic persistent-hash dialog -check 0"
feature option="Info -button"
feature option="Save in hash file -button"
feature option="Clear Hash -button"
feature done=1


Not sure why, but my image link fails
Image
Retired actuary and software developer. I love chess, coffee, wine and food
User avatar
hgm
Posts: 27870
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Duck Chess

Post by hgm »

This appears to work as it should. I have no idea why the same thing would not happen when the engine command is given by XBoard. In the debug file it says it tries to start the same command (StartChildProcess). The error seems to occur in the routine StartChildProcess in usystem.c. There are a few calls to perror there, which would print system error messages. It is probably the one after the execv() call, which indicates that execution of the engine command failed, and gives the reason why. Apparently there are parentheses in the engine command, which it doesn't like. But there should not be any; the engine command should just be 'fairymax', as was printed in the debug file just before this happens.

It is a complete mystery to me.