Deep duck is an engine to evaluate and sugest moves for the duck chess variant.
When I found this game and played it online, I quickly discovered that I was pretty bad at it. Then I thought "Well, I will play against some bots and then come back here"
. To my surprise bots didn't existed yet, so I made my own.
Yeah, it already is much better than me (not that hard), and it is already stronger than the stockfish engine used in Pychess. Here you can see two games played between Duck Chess and Fairy Stockfish.
SPOILER ALERT: Deep duck won both!
This was implemented in Rust using the old fashioned way:
-
Taking inspiration on Deep Blue, its grandfather
-
Testing (almost) every move possible
-
Repeat this process for you and for your enemy some times
-
Then use a hand crafted evaluation to see if the outcome looks like a good position for you or not
If you are interestd in more details, here we go:
-
I am using Negamax with alpha-beta pruning and a simple move ordering.
-
To represent the board I am using the mailbox aproach, were I have an 64 sized array of pieces or empty squares. The other aproach usually involves some bitwise wizardry.
-
For performance reasons I just test 3 duck positions: the previous position of the moved piece, the position blocking the piece we think the enemy wants to move, the position we think the enemy wants to put the duck. That misses some cases were the duck can block two pieces the same time, but in general seems a very usefull heuristics.
In the future you will play it here, but it is not working yet.
In the meantime you can compile and run the CLI, then put in the FEN of your chess position. The engine will show the position and say the best the best movement it finds.
To help you with the FEN stuff use this nice editor from pychess, then copy and paste the FEN code. Here is an example of how you can use Deep Duck to evaluate a position for your game.
You will need Cargo. If you don't have it installed just run the following command on your terminal (check out here for more info):
curl https://sh.rustup.rs -sSf | sh
Then run this in your terminal:
cargo run --release
It is important to use the --release, because chess engine is a very time consuming task and every optimization is wellcome.