A pure Rust, dependency-free chess engine built to run anywhere.
I love chess a lot. It's definitely one of my favorite games ever. However, I've always been disappointed when trying to play chess digitally. Although wonderful websites like chess.com and lichess exist, it's near impossible to find something that runs on everything.
Now, let's unpack that.
The Minimax algorithm essentially iterates through all possible moves recursively, and assumes that whenever the computer plays, the human player will always respond with the best move.
This allows the computer to almost always play objectively better moves than the player.
As you can see with a little experimentation, it works quite well.
Because Minimax works by simply maximizing the AI's material advantage over the player, it's incredibly simple to abuse the algorithm by changing what it is maximizing.
Here, for example, is the opposite of a good AI. This AI tries to maximize YOUR material value, and will desperately try to offer you its pieces while still making legal moves.
Additionally, builtin, chess-engine offers an incredibly simple chess variant called Horde, which I find very fun.
Additionally, chess-engine supports getting all of the legal moves for a player. So, naturally, I had to add a random-move AI.