Duck Chess

Discussion of chess software programming and technical issues.

Moderator: Ras

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

Re: Duck Chess

Post by rgrosz789 »

hgm wrote: Sun Feb 26, 2023 9:37 am The problem is in backend.h: this contains a line

enum ICS_TYPE ics_type;

and is #included in nearly every .c file. That line should be entirely removed, as backend.c already declares ics_type, and is the only source file that refers to it. (Otherwise there should have been an 'external' in front of the definition in backend.h.)
I contacted Tim Mann, and told him that the same errors were in the master source at savannah.gnu.org. He fixed the problem and updated the code there.

I did a git clone and was finally able to compile the non-duck xboard with no errors.
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 Feb 26, 2023 9:37 am The problem is in backend.h: this contains a line

enum ICS_TYPE ics_type;

and is #included in nearly every .c file. That line should be entirely removed, as backend.c already declares ics_type, and is the only source file that refers to it. (Otherwise there should have been an 'external' in front of the definition in backend.h.)
I made a similar change and was able to compile your code for xboard.

In evalgraph.h, I added extern to the beginning of this line:
extern ChessProgramStats_Move * currPvInfo;
Retired actuary and software developer. I love chess, coffee, wine and food
User avatar
hgm
Posts: 28353
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Duck Chess

Post by hgm »

Indeed, the extern is needed to prevent a double definition. It appears the ics_type also needed that, because it is used in args.h, which is #included in xboard.c. Old compilers dit not complain about double definitions of externals, if these were identical.

I now also added that parch in my own repository.
rgrosz789
Posts: 121
Joined: Sat Dec 03, 2022 9:28 pm
Full name: Rick Groszkiewicz

Re: Duck Chess

Post by rgrosz789 »

hgm wrote: Mon Feb 27, 2023 9:22 am What is more serious is that this version of XBoard appears to totally mess up the move it receives from the second engine. E.g. it receives d7d5,d5d2 from the second engine, but then it sends d7d5,d2c5 to the first. It is a mystery where this d2c5 comes from. Since g8f6,f6e4 becomes g8f6,e4g6 it seems to use the received Duck to-square for the from-square of the Duck move, and the rank number of the to-square it cooks up seems to come from the rank of the FIDE to-square, but how it pulls the file of the to-square out of the hat?! The insane thing is that from first to second everything works fine. While this is handled by exactly the same code.

I thought other people had used XBoard for Duck Chess, and I never received any complainst until now. I will try to figure it out.
I re-compiled your latest versions of xboard and uci2wb to re-check this problem. I played several games against mayhemduck and identified a minor bug (which I will report). If I use mayhemduck for both engines, it still produces the same "duck move errors" as before.

I saved the xboard debug files, in case you want to see them.
Retired actuary and software developer. I love chess, coffee, wine and food
JohnWoe
Posts: 529
Joined: Sat Mar 02, 2013 11:31 pm

Re: Duck Chess

Post by JohnWoe »

rgrosz789 wrote: Fri Mar 03, 2023 11:21 pm
hgm wrote: Mon Feb 27, 2023 9:22 am What is more serious is that this version of XBoard appears to totally mess up the move it receives from the second engine. E.g. it receives d7d5,d5d2 from the second engine, but then it sends d7d5,d2c5 to the first. It is a mystery where this d2c5 comes from. Since g8f6,f6e4 becomes g8f6,e4g6 it seems to use the received Duck to-square for the from-square of the Duck move, and the rank number of the to-square it cooks up seems to come from the rank of the FIDE to-square, but how it pulls the file of the to-square out of the hat?! The insane thing is that from first to second everything works fine. While this is handled by exactly the same code.

I thought other people had used XBoard for Duck Chess, and I never received any complainst until now. I will try to figure it out.
I re-compiled your latest versions of xboard and uci2wb to re-check this problem. I played several games against mayhemduck and identified a minor bug (which I will report). If I use mayhemduck for both engines, it still produces the same "duck move errors" as before.

I saved the xboard debug files, in case you want to see them.
Thanks for the reports.
I think all these bugs are in Xboard/uci2wb. In MayhemDuck there's a list command, which shows all possible moves. If it makes illegal moves it shows it there. "list 8/7Q/7k/7p/4Bn2/6q1/6P1/7K_b_-_-_0_1"

I think MayhemDuck handles protocol correctly. Hopefully these Xboard bugs can be fixed so testing is possible. MayhemDuck has repetition problem, it plays similar games against DuckSlayer. I tried to add random element to root moves. Tho playing duck960 will solve this issue immediately. :D

MayhemDuck 2.0 works perfectly on wine + winboard. Xboard is better since I have to compile for Windows etc.

I managed to compile Xboard 4.9.1 on latest Linux Mint. Plus uci2wb. See uci2wb messed up black moves. The drop square is messed up. In the wrong order. CMD: are commands sent to MayhemDuck 2.0

Code: Select all

[Event "Computer Chess Game"]
[Site "desktop"]
[Date "2023.03.05"]
[Round "-"]
[White "MayhemDuck 2.0 (UCI2WB)"]
[Black "human"]
[Result "*"]
[TimeControl "180+1"]
[Variant "duck"]
[Annotator "1. +0,34"]

1. d4,c6 {+0,34/6} Nf6,f3 2. Nc3,c6 {+0,40/6 8} d5,f3 3. Bg5,d7 {+0,40/5 7}
Nc6,f3

-------------------------------

### MayhemDuck Commands ###

CMD: uci
CMD: isready
CMD: ucinewgame
CMD: isready
CMD: setoption name UCI_Variant value duck
CMD: ucinewgame
CMD: isready
CMD: position startpos moves
CMD: go btime 180000 wtime 180000 winc 1000 binc 1000
CMD: position startpos moves d2d4,d4c6 g8f6,f3g6
CMD: go btime 174660 wtime 173080 winc 1000 binc 1000
CMD: position startpos moves d2d4,d4c6 g8f6,f3g6 b1c3,c3c6 d7d5,f3c5
CMD: go btime 168620 wtime 166420 winc 1000 binc 1000
CMD: position startpos moves d2d4,d4c6 g8f6,f3g6 b1c3,c3c6 d7d5,f3c5 c1g5,g5d7 b8c6,f3b6
CMD: go btime 160480 wtime 160020 winc 1000 binc 1000
CMD: quit
I wrote a small shell script to compile and install all these programs easily. It will ship w/ MayhemDuck 2.1 whenever that is ready.
Some testing v2.0 vs v2.1 is needed w/ stable programs.
Here is a sneak peak

Code: Select all

#
# Compile and install Xboard + uci2wb on Linux computers
# And play duck chess w/ MayhemDuck
#
# > sudo sh xboard-helper.sh
#

# Compile + Install Xboard
wget http://hgm.nubati.net/transfer/xboard-4.9.1.tar.gz
tar -xf xboard-4.9.1.tar.gz
cd xboard-4.9.1
./configure
make
make install
cd ..

# Compile + Install UCI2WB
# Download by hand first !!!
# > http://hgm.nubati.net/cgi-bin/gitweb.cgi?p=uci2wb.git;a=tree;h=6b6a612223f609a4dc17ed776091af9fe53797c8;hb=6b6a612223f609a4dc17ed776091af9fe53797c8
tar -xf uci2wb-6b6a612.tar.gz
cd uci2wb-6b6a612
gcc -O2 -s UCI2WB.c -lpthread -o UCI2WB
cp UCI2WB /usr/games/uci2wb
cd ..

# Install MayhemDuck
cp mayhemduck /usr/games/mayhemduck

# Cleanup
rm -r uci2wb-6b6a612
rm -r xboard-4.9.1

# Play MayhemDuck
xboard -fcp "uci2wb mayhemduck" -variant duck
User avatar
hgm
Posts: 28353
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Duck Chess

Post by hgm »

Sorry this took so long, but holidays prevented me to look at this earlier. It appears the patches I made to WinBoard for implementing Duck Chess were never fully transferred to the git repository on my virtual Linux machine. I think this should now be solved, and apart from a few extra prints in -debug mode the source code in the latest commit in my git repository (v4.9.x branch) should now be identical to the one I compiled the WinBoard version from.
rgrosz789
Posts: 121
Joined: Sat Dec 03, 2022 9:28 pm
Full name: Rick Groszkiewicz

Re: Duck Chess

Post by rgrosz789 »

I missed your response too - this morning I downloaded and compiled your latest xboard.

I'm happy to report that mayhemduck is working properly on one of my linux Mint machines. I'll also try setting this up on two other computers.
Retired actuary and software developer. I love chess, coffee, wine and food
JohnWoe
Posts: 529
Joined: Sat Mar 02, 2013 11:31 pm

Re: Duck Chess

Post by JohnWoe »

Linux Mint latest: Xboard 4.9.1 finally works properly ! No more Winboard

Game that finally went smooth to the finish line. MayhemDuck 2.1 is just a bug fix version. Hoped to add more strength...

However v2.0 crashed. As Rick pointed out. I don't know why. But after fixes v2.1 works properly. I uploaded the improved version. You can activate debug w/ "debug 1" and deactivate w/ "debug 0" if there's problems. It writes to a file all commands sent in and out.

Also I put all these Linux programs here. Very simple to install: https://github.com/SamuraiDangyo/xboard-helper

Move 45. Kf4,e2 was really bad. MayhemDuck loses its Queen by force.
Analyse reveals MayhemDuck is so damn slow to reach sufficient depths. After depth 5 MayhemDuck sees it well. Needs more work.

Code: Select all

exclude: none best +tail                                          
dep	score	nodes	time	(not shown:  tbhits	knps	seldep)
  8	+1,38 	1,98G	7:50.55	e6e5,e5a2 
  7	+1,49 	774,2M	3:12.64	e6e5,e5a2 
  6	+1,73 	295,5M	1:11.64	e6f5,f5e4 
  5	+1,50 	152,1M	0:38.16	e6f7,f7a2 
  4	+1,42 	9,47M  	0:02.50	g3f4,f4e2 
  3	+1,54 	1,37M  	0:00.38	g3h2,h2a2 
  2	+1,93 	111936	0:00.03	g3f4,f4a2 
  1	+0,73 	4157    	0:00.00	f2f3,f3e4 
  0	# 

Code: Select all

[Event "Computer Chess Game"]
[Site "desktop"]
[Date "2023.03.18"]
[Round "-"]
[White "MayhemDuck 2.1 (UCI2WB)"]
[Black "MayhemDuck 2.1 (UCI2WB)"]
[Result "0-1"]
[TimeControl "180+2"]
[Variant "duck"]
[Annotator "1. +0,34   1... -0,10"]

1. d4,c6 {+0,34/6} Nf6,e4 {-0,10/6 9} 2. Nc3,c6 {+0,40/6 9} d5,d2
{-0,34/5 9} 3. Nf3,e5 {+0,34/5 8} Bf5,d2 {-0,07/5 8} 4. Ne5,c4 {+0,07/4 8}
Nc6,e3 {+0,38/5 8} 5. Nxc6,b8 {-0,38/4 8} bxc6,d2 {+0,38/5 8} 6. a4,b8
{-0,49/5 8} Ne4,d2 {+0,64/4 8} 7. e3,b8 {-0,54/5 7} Nxc3,b1 {+0,54/5 7} 8.
bxc3,b8 {-0,64/5 7} Qd6,e5 {+0,32/5 7} 9. Ba3,c5 {-0,13/5 7} Qh6,e4
{+0,13/4 7} 10. Bd3,a6 {+0,41/4 7} e6,e4 {-0,06/4 7} 11. O-O,e7 {+0,39/4 7}
O-O-O,c4 {-0,16/4 7} 12. Qf3,c5 {+0,61/5 6} Bd6,e4 {-0,45/4 6} 13. Ba6,b8
{+0,75/5 6} Kd7,c1 {-0,37/4 6} 14. Bd3,c5 {+0,64/4 6} Bxd3,e2 {+0,39/5 6}
15. Qxf7,e7 {-0,24/6 6} Kc8,c5 {+0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,c4 {+1,89/5 3} a4,b5 {-1,75/7 3} 43. Qg4,a3 {+1,90/6 3} Qd3,h5
{-1,70/6 3} 44. Qe6,e2 {+1,70/5 3} a3,h5 {-1,53/5 3} 45. Kf4,e2 {+1,42/5 3}
Qe4,e5 {+8,57/7 3} 46. Kg5,f5 {-8,57/7 3} Qxe6,c4 {+8,95/6 3} 47. h5,a2
{-9,11/6 3} Qe4,g3 {+9,11/5 3} 48. h6,f3 {-9,11/5 3} a2,g3 {+10,01/4 3} 49.
h7,a1 {-10,67/4 3} Qxh7,g3 {+11,10/4 3} 50. Kg4,a1 {-11,97/7 3} Qh2,f3
{+12,70/6 3} 51. Kf5,a1 {-13,51/6 3} Qxg2,f3 {+13,51/6 3} 52. Kf6,a1
{-14,22/6 2,9} Qxf2,g7 {+14,22/6 2,9} 53. Kg5,a1 {-19,21/7 2,9} Qxe3,g4
{+19,21/6 2,9} 54. Kf6,a1 {-20,08/8 2,9} Qe4,f7 {+20,01/6 2,9} 55. Kg5,a1
{-21,17/8 2,8} Kc8,f6 {+21,43/7 2,8} 56. Kh6,a1 {-22,31/9 2,8} Qf5,g7
{+22,31/7 2,8} 57. Kh7,g6 {-23,09/11 2,8} a1=Q,g7 {+22,61/7 2,8} 58. Kg8,c4
{-29,34/9 2,7} Qg6,f8 {+52,42/8 2,7} 59. Kh8,c4 {-104,85/10 0,1} Qxd4,g8
{+104,85/6 0,1} 60. Kh7,a8 {-104,85/4 0,1} Qxh7,a1 {+104,85/1 0,1}
{Xboard adjudication: King destroyed} 0-1
rgrosz789
Posts: 121
Joined: Sat Dec 03, 2022 9:28 pm
Full name: Rick Groszkiewicz

Re: Duck Chess

Post by rgrosz789 »

JohnWoe wrote: Sat Mar 18, 2023 9:58 pm Linux Mint latest: Xboard 4.9.1 finally works properly ! No more Winboard

Game that finally went smooth to the finish line. MayhemDuck 2.1 is just a bug fix version. Hoped to add more strength...

However v2.0 crashed. As Rick pointed out. I don't know why. But after fixes v2.1 works properly. I uploaded the improved version. You can activate debug w/ "debug 1" and deactivate w/ "debug 0" if there's problems. It writes to a file all commands sent in and out.

Also I put all these Linux programs here. Very simple to install: https://github.com/SamuraiDangyo/xboard-helper
I tried using your xboard-helper script, but no success.

I tried to use your debug option, but did NOT figure out the correct placement of "debug 1":

xboard -fcp "uci2wb mayhemduck debug 1" -variant duck
xboard -fcp "uci2wb mayhemduck" -variant duck "debug 1"
Image
Retired actuary and software developer. I love chess, coffee, wine and food
User avatar
hgm
Posts: 28353
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Duck Chess

Post by hgm »

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