5

I am creating a chess engine and I am creating a heuristic to change the board evaluation if there are doubled pawns. Now, I have no experience in creating engines, so I figured I would ask this site on how much to change it. The values of my pieces are as such:

King - 10,000

Queen - 100

Rook - 50

Bishop - 30

Knight - 30

Pawn - 10

I am thinking that doubled pawns should be -5 points, tripled -10 points, quadrupled -20 points and so on.

1
  • 3
    As this is a heuristic and not a full-grown position evaluation, a penalty of 5 feels ok, a double pawn (= 2 pawns) having the worth of 1,5 „normal“ pawns. -10 for tripled pawns makes a tripled pawn equal to 2 normal pawns, which also feels ok. Quadrupled pawns are worse than 2 normal pawns in my opinion, so the penalty should be higher. You could give some extra points for bishop pair, connected pawns, passed pawns, but again, you seem to look for a heuristic, and heuristics should be fast and simple. Sep 23, 2020 at 9:05

4 Answers 4

15

Start with whatever and tune it.

That's how chess engine programming works - you start with some number, and then tune it. For example you start with -5, then create another version with -10. You get the two engines to play against each other, and the one that wins more often is the "correct" version that you keep.

Of course as pointed out by other answers, doubled pawns aren't necessarily bad, so the next step is to start incorporating more features that can mitigate the doubled pawn penalty. For example you could say that if you have a pawn on an adjacent file that is defending the more advanced doubled pawn (e.g., a pawn on f3 given doubled pawns on e4 and e3), then remove the doubled pawn penalty. And then the testing process would start again, you take this patch and create a new fork, then get the two versions to play each other and retain the stronger version. And then you could tune, e.g. maybe "remove the doubled pawn penalty" is too strong, perhaps it should be "take only half the doubled pawn penalty", etc.

On another note, there is no "standard answer" to how large the doubled pawn penalty should be. Different engines will prefer different values - it depends on the rest of your evaluation function & search function. See this article which contains a paragraph about adding tripled pawn penalties to Ethereal:

You might ask- why can't someone just write a better evaluation function? The answer is that people are trying, but it's difficult. Andrew Grant told me that he tried to add a penalty for tripled pawns (because they're obviously terrible!), but for whatever reason the engine became weaker with that penalty. Code for positional subtleties is extremely unlikely to add strength.

1
  • It is possible (although I lack the experience to say whether it is probable) that checking for tripled pawns simply consumes too much computation on positions that are already known to be terrible anyway, preventing the engine from searching as deeply. Regardless of the specifics, engines are very complicated beasts, and the only way to know whether a change is good or bad is to test it empirically, as you say.
    – Kevin
    Sep 24, 2020 at 4:38
7

There's no real rule for how much do doubled pawns (or any other kind of weakness on the pawn structure) worse your position. There's not even a rule for piece value, specially if you'll add bonuses for things like centralized knights or the bishop pair.

In general, doubled pawns in a minority or balanced side tend to be less important than in a majority (as it'll make it harder to create a passed pawn)

Doubled pawns can also be a strength. Think for instance of 1.e4 e5 2.Nf3 Nf6 3.Nxe5 d6 4.Nf3 Nxe4 5.Nc3!? where White gives the possibility for his opponent to double his pawns hoping his king will be safer after castling long thanks to the extra protection it provides (note that White does not have a majority on the queenside)

Another illustrative example would be 1.e4 e5 2.Nf3 Nc6 3.Bb5 a6 4.Bxc6 dxc6 5.d4 exd4 6.Qxd4 here White gives up the bishop pair to make the "d" pawn move away and get a 4vs3 majority on the kingside that could eventually become a passed pawn. The 4vs3 majority Black has on the queenside is much harder to convert into a passed pawn. If all pieces were removed from the board, White would easily win the pawn endgame.

In short, there's no way to tell without knowing how your engine will evaluate other potentially related factors in the position. The main advantage you have is that you don't need to get it right the first time. You can create different versions of your engine with different values for certain parameters and test them against one another.

5

Doubled pawns aren't necessarily bad. They typically mean an open file and often can improve control of the center.

There's really no way to answer unless I know how you value the mobility of the pieces. Are the piece values you give fixed or baseline numbers that can be modified based on the position?

1

it depends

they may be worth more if they open a file for a rook in a somewhat closed position

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.