Games


Chess

Welcome to my Chess Game!

Instructions

  1. Human player: Click the piece you wish to select and click where you wish to move it.
  2. AI player: Click a the button saying how many layers you would like it to search!

Alpha-Beta Pruned Chess AI

Behaviour and Analysis

Performance: I believe the 4-layer-deep AI may have an ELO rating of at least 600, since I beat a chess.com AI with an ELO of 600 pretty easily in a one-out-of-one series. I acknowledge that this is not much of a sample size.

Opening: The AI makes a weird opening when it looks 1-4 layers deep, where it advances the knight first. This is simply because this position evaluates the highest. The 5 layer deep AI advances the king's pawn first (which is how I open as well).

Time: Since the AI looks a given number of layers forward for each move, expect the AI to take longer calculate its next move in the middle of a game, when there are the most possible options. Expect the opening and endgame to be quicker. This is an opportunity to stick iterative deepening in, but if I really wanted my code to be faster, I would just write it in C++.

Even vs. Odd Layers: The AI may be more aggressive when searching an odd number of layers deep (i.e. 1, 3, or 5). This is because it does not register that the opponent will play a counter move. The AI will also sometimes get stuck alternating between moves.

Endgame: The AI only looks a given number of moves ahead and it is also looking to capture the King, rather than checkmate. This means that it does not try to force a mate, rather it tries to prolong the game and capture as many enemy pieces as possible. This means that the AI may be left in an "unstable state" (i.e. anyone would know what to do next from that state). I figure that this is not harmful enough to warrant a fix, since it is just prolonging the game until its opponents inevitable demise. Ask a real chess expert what they think about this though. The AI is unable to come up with a coherent strategy to checkmate because it never looks deep enough to explore a mate. I think the end game is different enough that it would warrant a separate engine. Either that, or I could hard-code endgame tables. Not my idea of fun, unfortunately. I could do iterative deepening though!

Warnings

Bugs: There may be bugs. If you are trying to discretely win a chess tournament, please do not use this engine unless you want to risk losing. If you find a bug, please let me know!

Determinism: The AI is not necessarily deterministic. I have added randomness to it; however you can switch this randomness off (in the source code itself).

Colours: If you have any tips on a good colour palette, please share them!

Recording the Game: The game is not recorded, so it is difficult to take back a move (push F12 and manually edit the board and the turn).

Lesser Known Rules: Neither AI nor my board have the concept of a 3-repeated-move draw nor the 50 moves without capture/ pawn move draw. So if you are looking to force a draw like this, you can't! I also have not implemented other obscure chess rules (likely because I am unaware of them).