OliThink 5.4.0 has been published with an big leap in strength for only 3 lines of code
Posted: Tue Jun 16, 2020 1:03 pm
Dear community,
over a decade ago I made the last changes to my chess engine OliThink (http://brausch.org/home/chess).
Now I am announcing OliThink 5.4.0 http://brausch.org/home/chess/OliThink540.src.zip.
It has 2 important changes:
-"Analyze Mode"
-A code change that improved it over 100 ELO and it's only a few lines.
Technical background:
It's about the evaluation of "no mating material = draw". Prior to 5.4.0 this was the evaluation in evalc():
(*sf containing a number for the non-pawn-pieces (N=2, B=3, R=5, Q=9) and (pieceb[PAWN] & colorb[c]) == 0 means the are no pawns for the resp. side.
mn contains the position evaluation of mobility. The idea being to reduce any material advantage to a more "drawish" score.
Actually this was quite imprecise. Moreover it doesn't respect more complex positions like "KNN vs k", which are draw, so I changed this.
It's known, that the following combinations are theoretical draws:
KN vs k (2 vs 0)
KB vs k (3 vs 0)
KNN vs k (4 vs 0)
KR vs kx (5 vs s > 0) (except rare positions, which can be detected tactically)
To present this logic, I defined this function with s and t counting pieces (N=2, B=3, R=5, Q=9):
Then I used it in the method eval() where white and black piece evaluations are combined:
So, if either
1) w > 0, not having enough material, reduced w to about 0*.
2) w < 0, opponent not having enough material, increase w to about 0*.
*It's no good idea to use exact 0, because the king will jump completely randomly over the board, which could lead to a lucky mate in "RNK vs rk", which actually happened.
The most surprising part is the fact that this change of 3 lines improved the strength dramastically.
This was not to expected as most matches won't end in the position with no mating material, but of course a lot of principal variations do.
-Oliver
over a decade ago I made the last changes to my chess engine OliThink (http://brausch.org/home/chess).
Now I am announcing OliThink 5.4.0 http://brausch.org/home/chess/OliThink540.src.zip.
It has 2 important changes:
-"Analyze Mode"
-A code change that improved it over 100 ELO and it's only a few lines.
Technical background:
It's about the evaluation of "no mating material = draw". Prior to 5.4.0 this was the evaluation in evalc():
Code: Select all
> if (*sf <= 3 && !(pieceb[PAWN] & colorb[c])) mn = -200; //No mating material
mn contains the position evaluation of mobility. The idea being to reduce any material advantage to a more "drawish" score.
Actually this was quite imprecise. Moreover it doesn't respect more complex positions like "KNN vs k", which are draw, so I changed this.
It's known, that the following combinations are theoretical draws:
KN vs k (2 vs 0)
KB vs k (3 vs 0)
KNN vs k (4 vs 0)
KR vs kx (5 vs s > 0) (except rare positions, which can be detected tactically)
To present this logic, I defined this function with s and t counting pieces (N=2, B=3, R=5, Q=9):
Code: Select all
< #define NOMATEMAT(s, t, c) ((s <= 4 || (s == 5 && t > 0)) && (pieceb[PAWN] & colorb[c]) == 0)
Code: Select all
< if ((w > 0 && NOMATEMAT(sf1, sf0, 1)) || (w < 0 && NOMATEMAT(sf0, sf1, 0)))
< w = kmobil[kingpos[1]] - kmobil[kingpos[0]];
1) w > 0, not having enough material, reduced w to about 0*.
2) w < 0, opponent not having enough material, increase w to about 0*.
*It's no good idea to use exact 0, because the king will jump completely randomly over the board, which could lead to a lucky mate in "RNK vs rk", which actually happened.
The most surprising part is the fact that this change of 3 lines improved the strength dramastically.
This was not to expected as most matches won't end in the position with no mating material, but of course a lot of principal variations do.
-Oliver