Beating Myself at Chess
Key topics
A developer's DIY chess engine has sparked a lively discussion, with many users sharing their experiences playing against it and pointing out its glaring weaknesses, such as promoting pawns in the opening and mid-game, and being oblivious to common tactics like exploiting the vulnerable f7 square. Commenters agree that the engine's simplicity is both its strength and weakness, with some noting that it can still snag wins by capitalizing on opponents' blunders. Despite its flaws, the project has inspired others to try building their own chess engines, with one user sharing their own experience writing a chess engine in Java. As users poke fun at the engine's shortcomings, they're also highlighting the value of hands-on projects like this for learning and improvement.
Snapshot generated from the HN discussion
Discussion Activity
Active discussionFirst comment
4d
Peak period
19
96-108h
Avg / period
10
Based on 20 loaded comments
Key moments
- 01Story posted
Dec 30, 2025 at 10:03 AM EST
9 days ago
Step 01 - 02First comment
Jan 3, 2026 at 3:32 PM EST
4d after posting
Step 02 - 03Peak activity
19 comments in 96-108h
Hottest window of the conversation
Step 03 - 04Latest activity
Jan 4, 2026 at 12:46 AM EST
4d ago
Step 04
Generating AI Summary...
Analyzing up to 500 comments to identify key contributors and discussion patterns
Want the full context?
Jump to the original sources
Read the primary article or dive into the live Hacker News thread when you're ready.
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.
But if you intentionally hang your pieces, it tends to take them. And it will try to promote pawns in the endgame. So it is possible for it to stumble upon a checkmate, though in my effort where I gave away all my pieces, it instead found the only move to stalemate once it had K+Q+R vs K.
Chose the most aggressive move (in term of pieces value and check-mate), if none is aggressive, it takes on of the move equally non aggressive.
Didn't remember the depth of the algorithm but it was very simple C code, could check quickly. It should be able to find a mate in 2 or 3 if it was in position of having one.
I didn't check the correctness of the algorithm, just the intention.
I applaud the effort but not sure I see the point, I had a more capable chess playing program than this on a zx speccy in the 80’s.
Link I get shows 500 lines and it starts with 50 lines of piece-square tables. Maybe it's obvious when you are into the domain but otherwise... that's pretty much of opposite of what I would call "readable".
The file is 500 lines because of the piece square tables (as you mentioned), comments, and the CLI interface logic
Previous HN thread here: https://news.ycombinator.com/item?id=20068651
> I got 111 by deleting the tables in the top, and the UI code in the bottom, and then running 'cloc' on the result. That gave 20 blanks, 56 comments and 111 lines of code. ;-)
``` 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.
I always hated that video mode, but it looks good here when the magenta and cyan are limited just to links and headers!