I'm just here to comment on the CGA color palette on this website, lol.
I always hated that video mode, but it looks good here when the magenta and cyan are limited just to links and headers!
Bug report: I got to a late-middlegame position and then the bot crashed because it tried to castle illegally (after its queenside rook had already moved):
``` Uncaught Error: Invalid move: {"from":"e8","to":"c8"} at Chess.move (chess.js:2530:23) at cm-chessboard/:75:23 ```
There didn't seem to be a way to recover besides refreshing.
Would maybe benefit from a "Checkmate!" or other finish screen, but cool project! Though I agree that it beating you may be more based on your skill level than its, given how it keeps pushing pawns.
The ai source code doesn't seem to have alpha-beta pruning yet. If you add that plus some basic move-ordering (killer move heuristic is easy, powerful, and has a cool name) that will let it search a lot deeper. One nice thing about such improvements is they converge to the same result, just faster, so unlike tweaking the evaluation function you can be pretty sure that you're improving it.
It is very humbling to write your own chess engine.
I was surprised how quickly I created a chess engine with Claude code a few months ago. It worked quite well. It was bad at recognizing certain chess patterns so I created a lot of tests for the chess engine.
Note most modern Chess engines use UCI instead of Winboard protocol. But either is fine really.
It is terrible in the opening and a little better in the middle game (if you didn't win already, I mean if you played 4-5 random moves).
I think you can improve it a lot by taking into account its own position. I mean, moving forward isn't very important want you are under the menace of a checkmate somewhere else.
It's a fun little AI, but I have another bug report. This time my move is the one that made it crash!
Uncaught Failed to apply player move! cm-chessboard:69:55
promotion result
Object { type: "pieceSelected", square: "c8", piece: "wq" }
cm-chessboard:111:37
Uncaught Error: Invalid move: {"from":"d7","to":"c8","promotion":"q"}
I had forked a rook and king with a pawn. Pawn takes rook, and was going to be offered a promotion, but taking and promoting at once seems to make it crash.
For people interested in making their own, I highly recommend reading through https://github.com/thomasahle/sunfish/blob/master/sunfish.py , a surprisingly readable and surprisingly strong chess engine in 111 lines of Python
https://www.chessprogramming.org/ is also really interesting, see e.g. https://www.chessprogramming.org/Sunfish and https://www.chessprogramming.org/Quiescence_Search