This is really weird. Passing the move from the first engine to the second works fine, but from the second to the first the Duck move is completely randomized (sometimes not even alphanumeric). While it is exactly the same code that does this, just called with the engine numbers swapped.
I will look into it.
Duck Chess
Moderator: Ras
-
- Posts: 28353
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
-
- Posts: 28353
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: Duck Chess
Should be fixed now.
Beware that the official move format (to be compatible with the WinBoard Alien Edition) has the promotion suffix on the second leg of the move. (Because the comma after the first leg was handled as a promotion suffix there.) The Quack engine was doing this wrong, (also on input, making it overlook promotions). I fixed this too, but the engine remains horrendously stupid. (Because the Duck move is completely random, so that it easily exposes its King.)
Beware that the official move format (to be compatible with the WinBoard Alien Edition) has the promotion suffix on the second leg of the move. (Because the comma after the first leg was handled as a promotion suffix there.) The Quack engine was doing this wrong, (also on input, making it overlook promotions). I fixed this too, but the engine remains horrendously stupid. (Because the Duck move is completely random, so that it easily exposes its King.)
-
- Posts: 183
- Joined: Tue Jun 20, 2006 4:41 am
- Location: USA
Re: Duck Chess
Thanks. Working better now. It looks like Winboard doesn't understand the win condition for duck chess. It seems to let the game continue after a king is captured. I saw in one case, it adjudicated stalemate after a lone king was captured.
Is the engine expected to still send a duck move after capturing the enemy king? (I tried with and without doing this.)
Since chess.com has this variant, I wonder what the chess.com rules for duck chess are for draws by insufficient material. It looks like endgames KNK and KBK (having only a knight or bishop) can very often be forced wins for the stronger side. So I hope they don't consider these as draws automatically.
Is the engine expected to still send a duck move after capturing the enemy king? (I tried with and without doing this.)
Since chess.com has this variant, I wonder what the chess.com rules for duck chess are for draws by insufficient material. It looks like endgames KNK and KBK (having only a knight or bishop) can very often be forced wins for the stronger side. So I hope they don't consider these as draws automatically.
-
- Posts: 28353
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: Duck Chess
I had WinBoard set the F_IGNORE_CHECK flag for this variant, which it also uses in Giveaway and Atomic. Without that it was already rejecting moves that stayed in check before the Duck was moved. But indeed this does not do what is required for win detection. I suppose there should be an easy fix to this, as it does not allow you to blow up your own King in Atomic.
WinBoard curently does not really check legality in Duck Chess, though: it does not check whether the Duck is moved, or whether it captures (and what it captures). So you could send a single move for King capture. Provided you do not suffix it with a comma.
I would not worry about potential bugs in the chess.com implementadion. In WinBoard you should not switch the insufficient material adjudication on.
[Edit] OK, I made a new version, which subjects Duck Chess to the same test as Atomic Chess, and declares the game a win for the side to move in positions where there are fewer than two Kings.
WinBoard curently does not really check legality in Duck Chess, though: it does not check whether the Duck is moved, or whether it captures (and what it captures). So you could send a single move for King capture. Provided you do not suffix it with a comma.
I would not worry about potential bugs in the chess.com implementadion. In WinBoard you should not switch the insufficient material adjudication on.
[Edit] OK, I made a new version, which subjects Duck Chess to the same test as Atomic Chess, and declares the game a win for the side to move in positions where there are fewer than two Kings.
-
- Posts: 183
- Joined: Tue Jun 20, 2006 4:41 am
- Location: USA
-
- Posts: 28353
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: Duck Chess
Perhaps it is not such a good idea to have the 'from-square' of the second leg equal to the to-square of the first leg. The regular edition of WinBoard required this, because it did not have general multi-move capability (such as the Alien Edition), and the multi-leg move format was only understood in so far it was needed in Chu Shogi, for the Lion (which is a double mover).
But by now Duck Chess uses different code to combine the two legs anyway, and in fact ignores the from-square of the second leg completely. So perhaps it is better to let the engine print the real from-square of the Duck there. That would also make it easier for future versions of XBoard to check the legality of the Duck move. (Otherwise it would have to scan the board to know where the Duck is.)
For now it is recommended the engine ignores the from-square of the second leg too, so that we can decide later what the GUI should write there, without running into backward-compatibility problems.
But by now Duck Chess uses different code to combine the two legs anyway, and in fact ignores the from-square of the second leg completely. So perhaps it is better to let the engine print the real from-square of the Duck there. That would also make it easier for future versions of XBoard to check the legality of the Duck move. (Otherwise it would have to scan the board to know where the Duck is.)
For now it is recommended the engine ignores the from-square of the second leg too, so that we can decide later what the GUI should write there, without running into backward-compatibility problems.
-
- Posts: 59
- Joined: Fri Oct 25, 2019 7:58 pm
- Full name: Michael Taktikos
Re: Duck Chess
[Event "Duck Chess Game"]
[Site "DESKTOP-UG2MCF4"]
[Date "2022.11.08"]
[Round "-"]
[White "DuckChess.zrf"]
[Black "Quack 1.3b"]
[Result "1-0"]
[TimeControl "40/300"]
[Variant "duck"]
1. Nc3,f6 c6,h5 2. Nf3,b6 a5,a3 3. Ne5,a7 f5,h4 4. d3,d2 e6,d5 5. a4,e7
h6,a7 6. Ng6,h7 Bd6,a3 7. Nxh8,e7 Nf6,a2 8. Bf4,e5 Na6,h4 9. Bxd6,b4 g5,h5
10. Be5,b8 Nc5,h5 11. Bxf6,e7 d6,g8 12. Bxd8,b1 Kxd8,b5 13. Nf7,f4 Kc7,f8
14. Nxh6,d4 Ra6,e7 15. d4,e4 Nd7,h8 16. Nf7,b6 g4,b3 17. Qd3,f6 d5,d8 18.
Kd2,b6 Nf6,e5 19. Ng5,a8 b6,h5 20. Qxa6,b7 Ne4,d3 21. Ncxe4,b7 fxe4,b5 22.
Qa7,b7 Bd7,e7 23. Qxc7,h8
{Xboard adjudication: King destroyed} 1-0
Comments for HGM: No illegal moves detected (but what can be improved, is that in the last move, after White captured the King, needed to continue to make a duck move). The Quack engine survived this time 23 moves.
Since until now the duck in the Quack engine makes random moves, this and the two games before are not to be taken as engine matches, but perhaps helpful for the progress of Quack.
What doubtless needs to be fixed is the surprising move 22... Bd7,e7, while with 22... Kc7-d6, e6 the King could escape of being immediately captured.
BTW I like the duck icon in your new Winboard. In the images folder of Zillions I didn't found a duck, only a bird that cannot be exactly recognized as a duck
Do you allow me to use your icon ?
[Site "DESKTOP-UG2MCF4"]
[Date "2022.11.08"]
[Round "-"]
[White "DuckChess.zrf"]
[Black "Quack 1.3b"]
[Result "1-0"]
[TimeControl "40/300"]
[Variant "duck"]
1. Nc3,f6 c6,h5 2. Nf3,b6 a5,a3 3. Ne5,a7 f5,h4 4. d3,d2 e6,d5 5. a4,e7
h6,a7 6. Ng6,h7 Bd6,a3 7. Nxh8,e7 Nf6,a2 8. Bf4,e5 Na6,h4 9. Bxd6,b4 g5,h5
10. Be5,b8 Nc5,h5 11. Bxf6,e7 d6,g8 12. Bxd8,b1 Kxd8,b5 13. Nf7,f4 Kc7,f8
14. Nxh6,d4 Ra6,e7 15. d4,e4 Nd7,h8 16. Nf7,b6 g4,b3 17. Qd3,f6 d5,d8 18.
Kd2,b6 Nf6,e5 19. Ng5,a8 b6,h5 20. Qxa6,b7 Ne4,d3 21. Ncxe4,b7 fxe4,b5 22.
Qa7,b7 Bd7,e7 23. Qxc7,h8
{Xboard adjudication: King destroyed} 1-0
Comments for HGM: No illegal moves detected (but what can be improved, is that in the last move, after White captured the King, needed to continue to make a duck move). The Quack engine survived this time 23 moves.
Since until now the duck in the Quack engine makes random moves, this and the two games before are not to be taken as engine matches, but perhaps helpful for the progress of Quack.
What doubtless needs to be fixed is the surprising move 22... Bd7,e7, while with 22... Kc7-d6, e6 the King could escape of being immediately captured.
BTW I like the duck icon in your new Winboard. In the images folder of Zillions I didn't found a duck, only a bird that cannot be exactly recognized as a duck

_____________________
https://github.com/mtaktikos?tab=repositories
https://github.com/mtaktikos?tab=repositories
-
- Posts: 28353
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: Duck Chess
Sure, consider the duck image public domain. I drew it myself as SVG, but I did use some inspiration from a PNG file I found. I am not sure if that image was copyrighted, but I suppose it is sufficiently generic that the shape of the duck cannot really carry any copyrights.
As far as Quack 1.3d is concerned: it was only mentioned as a test engine for the communication protocol. It is derived from N.E.G. 1.3d, which even without Duck was already an ultra-weak engine, which would beat a random mover, but not much more. It doesn't search, and just captures insufficiently protected or more valuable pieces (calculated by a flaky SEE approximation, which only takes into account the number of attackers and protectors, the value of the captured piece, the attacker and the lowest-valued protector. (Or moves a piece away when a similarly calculated exchange from the opponent would cause a loss larger than the best capture it could make itself.)
It would be hard to make it do something sensible with the Duck. I suppose it should calculate the treats against it without Duck; that would already prevent it from moving away a pinned Duck to expose his King; it would already think it is in check, and move its King to a safe square (and then place the Duck randomly).
It would be nice if it could somehow determine for every exchange whether a Duck could affect it. I suppose it could ignore the lowest distant protector when evaluating its own captures (and remember on which square unequal to the current Duck square it could be blocked). It still should calculate how it would end without Duck intervention, as it might be more important to use a the Duck for defense. When calculating the threats it should similarly ignore one of its own protectors. If there is a threat that way that is worse than what it could gain with the aid of the Duck, it is more important to defend than to play the Duck-assisted capture. If it can defend with the Duck, it could still do a Duck-free capture, if a profitable one is available. If the threatened piece can make a Duck-assisted capture (or escape) that would also be good. Or it could make a Duck-free escape from the worst threat, and then use the Duck to defend against the second-worst threat. And it would somehow have to pick the best of those possibilities. Complex...
As far as Quack 1.3d is concerned: it was only mentioned as a test engine for the communication protocol. It is derived from N.E.G. 1.3d, which even without Duck was already an ultra-weak engine, which would beat a random mover, but not much more. It doesn't search, and just captures insufficiently protected or more valuable pieces (calculated by a flaky SEE approximation, which only takes into account the number of attackers and protectors, the value of the captured piece, the attacker and the lowest-valued protector. (Or moves a piece away when a similarly calculated exchange from the opponent would cause a loss larger than the best capture it could make itself.)
It would be hard to make it do something sensible with the Duck. I suppose it should calculate the treats against it without Duck; that would already prevent it from moving away a pinned Duck to expose his King; it would already think it is in check, and move its King to a safe square (and then place the Duck randomly).
It would be nice if it could somehow determine for every exchange whether a Duck could affect it. I suppose it could ignore the lowest distant protector when evaluating its own captures (and remember on which square unequal to the current Duck square it could be blocked). It still should calculate how it would end without Duck intervention, as it might be more important to use a the Duck for defense. When calculating the threats it should similarly ignore one of its own protectors. If there is a threat that way that is worse than what it could gain with the aid of the Duck, it is more important to defend than to play the Duck-assisted capture. If it can defend with the Duck, it could still do a Duck-free capture, if a profitable one is available. If the threatened piece can make a Duck-assisted capture (or escape) that would also be good. Or it could make a Duck-free escape from the worst threat, and then use the Duck to defend against the second-worst threat. And it would somehow have to pick the best of those possibilities. Complex...
-
- Posts: 59
- Joined: Fri Oct 25, 2019 7:58 pm
- Full name: Michael Taktikos
Re: Duck Chess
Thx for the icon, have updated my DuckChess repository:
https://github.com/mtaktikos/DuckChess
https://github.com/mtaktikos/DuckChess
Yes, way too complex to consider all this points. In Zillions the following idea works: Every side has in hand 300 ducks that can be dropped. A move consists of three parts: 1) making a normal chess move, while a duck cannot be captured and only knights can jump over a duck, 2) removing the existing duck from the board and 3) dropping a new duck on an empty square. Since the second part doesn't need any search, for the remaining two a double-move alphabeta algorithm (as you have already implemented for the lion in Chu Shogi, and is also included in Zillions) considers automatically the points you mentioned above, so they don't have to be implemented explicitly one by one.hgm wrote: ↑Tue Nov 08, 2022 10:52 pm When calculating the threats it should similarly ignore one of its own protectors. If there is a threat that way that is worse than what it could gain with the aid of the Duck, it is more important to defend than to play the Duck-assisted capture. If it can defend with the Duck, it could still do a Duck-free capture, if a profitable one is available. If the threatened piece can make a Duck-assisted capture (or escape) that would also be good. Or it could make a Duck-free escape from the worst threat, and then use the Duck to defend against the second-worst threat. And it would somehow have to pick the best of those possibilities. Complex...
_____________________
https://github.com/mtaktikos?tab=repositories
https://github.com/mtaktikos?tab=repositories
-
- Posts: 28353
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: Duck Chess
I now included an improved version of the Quack engine in the Duck2.zip archive. It no longer plays the Duck randomly, but try to make use of it.
Problem was that the original engine was totally unaware that blocking a move could be helpful to solving threats. The only solution it knew was moving the threatened piece away. This led to embarassing moves in positions like
[fen]rnbqkb1r/1pp2ppp/p2ppn2/6B1/3PN3/8/PPP1PPPP/R2QKBNR w KQkq - 0 5[/fen]
(where after Bxf6 it would play Qd7, because it considered it more important to rescue its Queen from the BxQ threat than to gain a Bishop through gxf6) and
[fen]rnbqkbnr/1ppp1ppp/p3p3/6B1/3P3P/8/PPP1PPP1/RN1QKBNR b KQkq h3 0 3[/fen]
(where it would play Qxg5 because it saw no way to solve the BxQ threat).
So I started by solving that, at least in simple cases where the threat is from a single attacker. Before evaluating individual moves it detects all such threats, and marks the square of the attacker and all squares on the threat ray as solving the threat. So that moves that land there do get the extra bonus for solving the threat, in addition to its own accomplishments.
This works: in the given positions it now plays gxf6 and Be7, respectively. Strange enough this does not help at all to make it play stronger; the score against the old version in 2000 games was within the error bars of equality.
Anyway, after this change it was possible to make it usefully employ the Duck. When it is detecting threats it keeps track of the worst 'simple' threat that it can cure by interposing a Duck. And it then scores every move twice: once ignoring the protection if there is a single blockable protector, pairing the move with the Duck move to the location where it could block it, and a second time normally, but adding the bonus for solving of the worst pending threat by Duck intervention (if the move itself did not already solve that threat).
This works nicely; in the following position
[fen]rnbqkb1r/pppppppp/1*3n2/8/4P3/8/PPPPQPPP/RNB1KBNR b KQkq - 2 2[/fen]
It would play Nxe4,e3. And if the Duck already is on e3, it would refrain from capturing the Pawn. The new version beats the old one with a 70% score, in Duck Chess.
Problem was that the original engine was totally unaware that blocking a move could be helpful to solving threats. The only solution it knew was moving the threatened piece away. This led to embarassing moves in positions like
[fen]rnbqkb1r/1pp2ppp/p2ppn2/6B1/3PN3/8/PPP1PPPP/R2QKBNR w KQkq - 0 5[/fen]
(where after Bxf6 it would play Qd7, because it considered it more important to rescue its Queen from the BxQ threat than to gain a Bishop through gxf6) and
[fen]rnbqkbnr/1ppp1ppp/p3p3/6B1/3P3P/8/PPP1PPP1/RN1QKBNR b KQkq h3 0 3[/fen]
(where it would play Qxg5 because it saw no way to solve the BxQ threat).
So I started by solving that, at least in simple cases where the threat is from a single attacker. Before evaluating individual moves it detects all such threats, and marks the square of the attacker and all squares on the threat ray as solving the threat. So that moves that land there do get the extra bonus for solving the threat, in addition to its own accomplishments.
This works: in the given positions it now plays gxf6 and Be7, respectively. Strange enough this does not help at all to make it play stronger; the score against the old version in 2000 games was within the error bars of equality.
Anyway, after this change it was possible to make it usefully employ the Duck. When it is detecting threats it keeps track of the worst 'simple' threat that it can cure by interposing a Duck. And it then scores every move twice: once ignoring the protection if there is a single blockable protector, pairing the move with the Duck move to the location where it could block it, and a second time normally, but adding the bonus for solving of the worst pending threat by Duck intervention (if the move itself did not already solve that threat).
This works nicely; in the following position
[fen]rnbqkb1r/pppppppp/1*3n2/8/4P3/8/PPPPQPPP/RNB1KBNR b KQkq - 2 2[/fen]
It would play Nxe4,e3. And if the Duck already is on e3, it would refrain from capturing the Pawn. The new version beats the old one with a 70% score, in Duck Chess.