For the past few months, I have been experimenting with Stockfish with the goal of making the AI more fun to play against.

Stockfish is obviously a very powerful Chess AI but it plays very conservatively (my understanding is all powerful chess ai ). From a humans perspective, this is kind of boring and this is especially true for new or inexperienced chess players. Additionally, when in a losing position, often moves can become totally nonsensical.

I have had middling success so far by modifying various weights in stockfish's evaluation function. I want to create Chess AI that is totally ruthless, never plays for a draw and wants to end the game in a checkmate as soon as possible, potentially assuming greater risk in aid of that goal.

I'm not so worried about the playing strength of the chess engine, my goal is to create a a fun and engaging chess experience for more than just expert level players.

  • 1
    Such engines already exist (google :-) but I can't answer your question how to specifically tune Stockfish, sorry. Sep 21, 2022 at 7:28
  • Do you have any specific recommendations?
    – TinyCamera
    Sep 21, 2022 at 16:25
  • 1
    Google :-) In two seconds I found e.g. pkoziol.cal24.pl/opental - a chess engine that plays like Tal (or so they say). And it surely wasn't the one I dimly remembered. Sep 21, 2022 at 18:15
  • 1
    BTW Stockfish with neural nets is not as conservative as engines used to be. If it senses the opportunity it will start attacking immediately and aggressively, not afraid to sacrifice pieces, while previous engines were more conservative about material. It's pretty terrifying to be on the recieving end.
    – qwr
    Sep 22, 2022 at 17:27
  • 1
    Coding that into Stockfish's evaluation function shouldn't be hard. The problem is coming up with a "computable" definition of what it is to be aggressive.
    – David
    Oct 6, 2022 at 17:14

2 Answers 2


There's this number in Stockfish's code that assigns the value of a draw. This is typically 0 for obvious reasons - if your position is better (> 0.00) then it's preferable to avoid a draw, while if your position is worse (< 0.00) then the reverse applies.

If you change this value to a smaller number, then the engine will view drawing as worse than a slightly inferior position. In fact if you change this to a big negative number, then the engine will view getting mated as better than a draw. You will therefore get an engine that "never plays for a draw".

Making an engine that "wants to end the game in a checkmate as soon as possible" is a different matter, and it's unclear how you can do that, since the engine will always choose what its algorithm says are the best moves, not the one that is "most aggressive".

  • Thank you for the reply! Instead of making the engine more aggressive(which is somewhat subjective) how about making the engine privilege shorter games over longer ones? Would that be possible?
    – TinyCamera
    Sep 21, 2022 at 16:23
  • About the last paragraph, my understanding is that Stockfish uses a lot heuristics, so couldn't we add more heuristics, for example: development gets a bonus, pawns around enemy king are worth more, and so on, that should make Stockfish more aggressive, though weaker.
    – Akavall
    Sep 22, 2022 at 3:54
  • @TinyCamera I don't see how one would go about programming that, though. (And why would you want to? Winning in 100 moves is better than losing/drawing in 99.)
    – Allure
    Sep 22, 2022 at 5:01
  • @Akavall I suppose you could, yeah (although that would only be classical eval - it's not clear how to apply it to NNUE eval).
    – Allure
    Sep 22, 2022 at 5:01

I think the kind of exciting chess you're talking about boils down to an engine that evaluates very accurately like Stockfish, but sometimes plays inaccurate lines which contain very favorable variations. In my experience, that is what people miss about the old way of playing in the pre-engine era, which is that you take risks (meaning your position is strictly worse with best play from your opponent) but you know that its very tricky to find the best replies.

If you want to make your own engine that plays like this and you know some python, I'd suggest the python-chess package. It has interfaces to interact with standard UCI engines such as stockfish. You could also interact with the engine with plain shell scripting or really any language that is capable of starting a command-line process and reading/writing to its standard in/out streams. To make your engine, you could 1) query stockfish for its top moves and the lines that result, 2) come up with your own heuristic metrics for which of the lines is most "exciting" or "tricky", and 3) output that move from your engine instead of the top move. So the key thing there is how to make the "excitingness" detector. You could start your heuristics with looking for lines where the top reply is bad for you up to some threshold (say -1.0 from your perspective), but all the other reasonable replies are good for you. The problem with this kind of crude excitingness detector is that it basically will play forcing moves hoping the opponent doesn't find the easy-to-find best reply. For example, it'll take pieces hoping that the opponent doesn't take back, but if they do, you're in a worse position than if you had played something else. But maybe taking that as a starting point and thinking of other features of moves/lines/variations that make them "exciting" and combining it all together, you can get an engine that plays in the old style of Tal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.