# Will writing a chess engine help my chess?

At first the premise seems absurd - the computer engine relies much more on brute-force search (Shannon's Type A Strategy) over selecting a few strong lines with heuristics (Type B Strategy). But can the process of creating and testing the evaluation function actually help my human chess playing at all? For example, I learned from Chess Programming Wiki that a bishop pair gives a small bonus roughly half a pawn, knights do better than bishops when there are many pawns on the board, and that certain pieces are stronger in general on certain squares. By testing out what the computer values, perhaps these ideas (such as checks, captures, threats) can transfer a little to real-world play.

I am interested if anyone here has written an engine and feels that the process has helped them OTB as a side-effect.

Related discussion on chess.com

• No it won't. This is similar to when someone asks if learning graph theory will help them better calculate the tree of variations. Commented Aug 5, 2022 at 7:23

I wrote an engine a while back. I would call myself a "competent inactive chess player," defining that as in the uncomfortable divide where playing people who aren't active chess players is so easy that it isn't even sportsmanlike, but playing against active players is humbling. For a class, I had to write a chess engine. From my experience, I do not believe you can learn much about chess this way.

When building up an engine, you spend much of your time teaching it not to do monumentally stupid moves. In my class, I was the only person who wrote an engine that didn't fall victim to the 4-move checkmate. My classmates were amazed at my ability to not hang pieces. Getting my chess program to out-perform an elementary student with 1 month of Chess under their belt was quite the challenge, and it certainly didn't teach me anything about the game. It taught me a great deal about game theory (which was, after all, the purpose of my course). It taught me about bitboards and perfect hashes, neither of which are used by humans during play.

So, in the effort to make a "good" engine, you may go out and borrow evaluation tricks from others. You yourself mentioned a few, such as a bishop pair being worth about 500 centipawns. However, behind this evaluation lies a subtle detail: do you know how to use said bishops to get your half-pawn advantage? Very rarely in engine development do we really consider how you are "supposed" to use these advantages. Instead, we make general algorithms which figure it out on the fly. They can't play for you, so its unlikely that knowing your bishop pair is worth half a pawn is enough to help you actually leverage it.

And let us never forget 36. axb5. This is the famous move from Kasparov v. Deep Blue that was so astonishing that Kasparov accused IBM of cheating. When you play, you don't play to some abstract generalized idea of what a good board is. You play to your strenghts. If you're good in tight lockded down positions, you play moves that lead to that. If you're good in open endgames, you play moves that get to open endgames. Computers play to computer's strengths. The value of particular positions is evaluated based on how well those computers can leverage those positions. In the case of axb5, the computer played a very "human" move. It put itself into a position that humans tended to be better at, and computers tended to be worse at. Well, as it turns out, it was a position that Deep Blue was good at too, and it proved it.

So all of the "rules of thumb" are no where near as important as finding out what you are good at, and following those rules of thumb. And you cannot get that from a chess engine.

If you are a beginner, then yeah it would help. As you wrote, "bishop pair gives a small bonus roughly half a pawn, knights do better than bishops when there are many pawns on the board, and that certain pieces are stronger in general on certain squares" - these are nontrivial pieces of chess knowledge that you can learn from writing an engine.

Past the beginner level though, it's not likely to be helpful - especially if you use NNs or NNUEs like the best modern engines do, in which case all the chess knowledge in the first paragraph don't matter anyway.

No. Humans and engines play chess in completely different ways. Being able to conclude that the evaluation function bonus for the bishop pair should be 0.3 rather than 0.2 will have pretty much no impact on your actual chess skill. People just don't think like that.

Even if there was a benefit to your chess by writing the code for an engine, there are definitely more effective training methods, like tactics, analysis, practice games and so on. You can learn the ideas you mention from a strategy book in a more complete way by watching illustrative examples and analyzing those games.

It is the other way around. Being a strong chess player allows you to write a good evaluation function. The evaluation functions of strong chess engines are known, and the principles they encapsulate are already taught to chess players in books and other means.

For example, there are countless videos, book chapters, etc. on the power of the bishop pair, similarly, it is well known to even weak players that bishops generally strive in open and knights in closed positions (this is why knights are better when there are more pawns). You would learn all that while reading chess books, without needing all the overhead of engine programming.

Moreover, you would learn why this is the case and only logical by reading books. If you understand such chess principles, you can try to build them into your evaluation function.

Yes, engine programming can make you aware of certain important concepts, but it won't necessarily help you to apply and understand them. On the other hand, the best way to improve in chess is to devote time to studying chess (not to fix annoying C++ bugs, so you would even have an opportunity cost if your goal was solely to improve in chess).

All that being said, I would like to encourage you to build your own engine. It is far more impressive to anyone if you can build a chess engine than if you have gained some Elo instead. Knowing how to program is also far more valuable in today's world and will bestow much more transfer use upon your life.