OliThink 5.4.0 has been published with an big leap in strength for only 3 lines of code

Discussion of chess software programming and technical issues.

Moderators: bob, hgm, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Post Reply
OliverBr
Posts: 500
Joined: Tue Dec 18, 2007 8:38 pm
Location: Munich, Germany
Full name: Dr. Oliver Brausch
Contact:

OliThink 5.4.0 has been published with an big leap in strength for only 3 lines of code

Post by OliverBr » Tue Jun 16, 2020 11:03 am

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():

Code: Select all

> 	if (*sf <= 3 && !(pieceb[PAWN] & colorb[c])) mn = -200; //No mating material
(*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):

Code: Select all

< #define NOMATEMAT(s, t, c) ((s <= 4 || (s == 5 && t > 0)) && (pieceb[PAWN] & colorb[c]) == 0)
Then I used it in the method eval() where white and black piece evaluations are combined:

Code: Select all

< 	if ((w > 0 && NOMATEMAT(sf1, sf0, 1)) || (w < 0 && NOMATEMAT(sf0, sf1, 0)))
< 		w = kmobil[kingpos[1]] - kmobil[kingpos[0]];
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
Chess Engine OliThink: http://brausch.org/home/chess
OliThink GitHub:https://github.com/olithink

Dann Corbit
Posts: 11512
Joined: Wed Mar 08, 2006 7:57 pm
Location: Redmond, WA USA
Contact:

Re: OliThink 5.4.0 has been published with an big leap in strength for only 3 lines of code

Post by Dann Corbit » Tue Jun 16, 2020 4:24 pm

It is a happy day when a new Olithink arrives.
Now we wait for lazy SMP.
;-)
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.

OliverBr
Posts: 500
Joined: Tue Dec 18, 2007 8:38 pm
Location: Munich, Germany
Full name: Dr. Oliver Brausch
Contact:

Re: OliThink 5.4.0 has been published with an big leap in strength for only 3 lines of code

Post by OliverBr » Tue Jun 16, 2020 9:29 pm

Dann Corbit wrote:
Tue Jun 16, 2020 4:24 pm
It is a happy day when a new Olithink arrives.
Now we wait for lazy SMP.
;-)
Hi Dann,
Lazy SMP is far away, when still bugs exists like playing Kf1 here on ply15. All those zeros are nonsense, too, because black won't do the repetition.


Code: Select all

 ./olithink540 
force
setboard 8/8/8/5k2/5p2/4q3/4K3/4R2R w - - 14 135
analyze
 1    -9      0         3  e2d1 
 2   -11      0       107  e2d1 e3c3 
 3    -9      0      1005  e2f1 e3d3 f1f2 d3g3 f2f1 
 4   -28      0      3501  e2d1 e3d3 d1c1 d3c3 c1b1 f4f3 
 5    -7      0      9111  e2d1 e3d3 d1c1 d3c3 c1b1 c3b3 b1a1 f4f3 
 6   -27      0     20514  e2d1 e3d3 d1c1 f4f3 h1h5 f5g4 h5h2 d3c3 c1d1 
 7     0      1     58780  e2f1 e3f3 f1g1 f3g3 g1f1 g3d3 f1f2 d3g3 f2f1 
 8     0      1     80750  e2f1 e3f3 f1g1 f3g3 g1f1 g3f3 
 9     0      3    154499  e2f1 e3f3 f1g1 f3g3 g1f1 g3f3 
10     0      5    256085  e2f1 e3f3 f1g1 f3g3 g1f1 g3f3 
11     0     10    452480  e2f1 e3f3 f1g1 f3g3 g1f1 g3f3 
12     0     42   1933782  e2f1 e3f3 f1g1 f3g3 g1f1 g3f3 
13     0     64   2999141  e2f1 e3d3 f1f2 d3g3 f2f1 g3f3 f1g1 f3g3 g1f1 
14   -90    478  25154780  e2d1 e3d3 d1c1 f4f3 h1f1 f5g6 f1g1 g6f7 g1f1 f7f6 e1d1 d3e3 c1b1 e3b6 b1c2 f3f2 d1e1 f6g5 
15     0   1162  59682377  e2f1 e3d3 f1f2 d3g3 f2f1 f4f3 h1g1 g3h2 g1g7 h2h1 g7g1 h1h2 
16   -97   3570 195944937  e2d1 e3d3 d1c1 f4f3 h1f1 f5f4 c1b2 d3d2 b2b3 f3f2 e1c1 d2d3 b3b4 d3e2 b4a5 e2d2 a5a6 d2d3 a6a7 d3d7 a7a8 d7d8 a8a7 
Chess Engine OliThink: http://brausch.org/home/chess
OliThink GitHub:https://github.com/olithink

Pio
Posts: 191
Joined: Sat Feb 25, 2012 9:42 pm
Location: Stockholm
Contact:

Re: OliThink 5.4.0 has been published with an big leap in strength for only 3 lines of code

Post by Pio » Tue Jun 16, 2020 10:56 pm

OliverBr wrote:
Tue Jun 16, 2020 9:29 pm
Dann Corbit wrote:
Tue Jun 16, 2020 4:24 pm
It is a happy day when a new Olithink arrives.
Now we wait for lazy SMP.
;-)
Hi Dann,
Lazy SMP is far away, when still bugs exists like playing Kf1 here on ply15. All those zeros are nonsense, too, because black won't do the repetition.


Code: Select all

 ./olithink540 
force
setboard 8/8/8/5k2/5p2/4q3/4K3/4R2R w - - 14 135
analyze
 1    -9      0         3  e2d1 
 2   -11      0       107  e2d1 e3c3 
 3    -9      0      1005  e2f1 e3d3 f1f2 d3g3 f2f1 
 4   -28      0      3501  e2d1 e3d3 d1c1 d3c3 c1b1 f4f3 
 5    -7      0      9111  e2d1 e3d3 d1c1 d3c3 c1b1 c3b3 b1a1 f4f3 
 6   -27      0     20514  e2d1 e3d3 d1c1 f4f3 h1h5 f5g4 h5h2 d3c3 c1d1 
 7     0      1     58780  e2f1 e3f3 f1g1 f3g3 g1f1 g3d3 f1f2 d3g3 f2f1 
 8     0      1     80750  e2f1 e3f3 f1g1 f3g3 g1f1 g3f3 
 9     0      3    154499  e2f1 e3f3 f1g1 f3g3 g1f1 g3f3 
10     0      5    256085  e2f1 e3f3 f1g1 f3g3 g1f1 g3f3 
11     0     10    452480  e2f1 e3f3 f1g1 f3g3 g1f1 g3f3 
12     0     42   1933782  e2f1 e3f3 f1g1 f3g3 g1f1 g3f3 
13     0     64   2999141  e2f1 e3d3 f1f2 d3g3 f2f1 g3f3 f1g1 f3g3 g1f1 
14   -90    478  25154780  e2d1 e3d3 d1c1 f4f3 h1f1 f5g6 f1g1 g6f7 g1f1 f7f6 e1d1 d3e3 c1b1 e3b6 b1c2 f3f2 d1e1 f6g5 
15     0   1162  59682377  e2f1 e3d3 f1f2 d3g3 f2f1 f4f3 h1g1 g3h2 g1g7 h2h1 g7g1 h1h2 
16   -97   3570 195944937  e2d1 e3d3 d1c1 f4f3 h1f1 f5f4 c1b2 d3d2 b2b3 f3f2 e1c1 d2d3 b3b4 d3e2 b4a5 e2d2 a5a6 d2d3 a6a7 d3d7 a7a8 d7d8 a8a7 
Hi Oliver!

What I am guessing is happening between depth 14 and 15 is that your engine finds a repetition in the e2d1 line which might not be so strange in this position because of all the checking opportunities. The problem seems to be that it will change its mind to prefer the e2f1-line with the same score. After it has changed its mind (which I think is a bug since it should only prefer a better move) I guess the second problem is that it will look on the e2f1-line a lot shorter maybe because of some PV extension but I am just guessing

/Pio

OliverBr
Posts: 500
Joined: Tue Dec 18, 2007 8:38 pm
Location: Munich, Germany
Full name: Dr. Oliver Brausch
Contact:

Re: OliThink 5.4.0 has been published with an big leap in strength for only 3 lines of code

Post by OliverBr » Thu Jun 18, 2020 8:07 pm

OliThink 5.4.1 is now available at http://brausch.org/home/chess!
Chess Engine OliThink: http://brausch.org/home/chess
OliThink GitHub:https://github.com/olithink

Gabor Szots
Posts: 586
Joined: Sat Jul 21, 2018 5:43 am
Location: Szentendre, Hungary
Full name: Gabor Szots

Re: OliThink 5.4.0 has been published with an big leap in strength for only 3 lines of code

Post by Gabor Szots » Fri Jun 19, 2020 4:11 pm

Hi Oliver,

I have just been made aware of your post but a test gauntlet with 5.4.0 is already running anyway. I am happy you are back with OliThink.
Gabor Szots
CCRL testing group

OliverBr
Posts: 500
Joined: Tue Dec 18, 2007 8:38 pm
Location: Munich, Germany
Full name: Dr. Oliver Brausch
Contact:

Re: OliThink 5.4.0 has been published with an big leap in strength for only 3 lines of code

Post by OliverBr » Sat Jun 20, 2020 12:04 am

Hi Gabor,
OliThink is evaluating, as we speak. Version 5.4.2 has been published.
Here is an example (31. Rc4!!)

Chess Engine OliThink: http://brausch.org/home/chess
OliThink GitHub:https://github.com/olithink

OliverBr
Posts: 500
Joined: Tue Dec 18, 2007 8:38 pm
Location: Munich, Germany
Full name: Dr. Oliver Brausch
Contact:

Re: OliThink 5.4.0 has been published with an big leap in strength for only 3 lines of code

Post by OliverBr » Sat Jun 20, 2020 12:58 am

@Gabor,
I recommend to use 5.4.2 in the tournament, because this is actually the best OliThink ever. Not only in the result, but also in "how".

Chess Engine OliThink: http://brausch.org/home/chess
OliThink GitHub:https://github.com/olithink

Dann Corbit
Posts: 11512
Joined: Wed Mar 08, 2006 7:57 pm
Location: Redmond, WA USA
Contact:

Re: OliThink 5.4.0 has been published with an big leap in strength for only 3 lines of code

Post by Dann Corbit » Sat Jun 20, 2020 8:24 am

Absolutely incredible that such a tiny program can beat Fruit in the ring.
The only comparable is pocket Hercules:
https://en.wikipedia.org/wiki/Naim_S%C3 ... no%C4%9Flu
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.

OliverBr
Posts: 500
Joined: Tue Dec 18, 2007 8:38 pm
Location: Munich, Germany
Full name: Dr. Oliver Brausch
Contact:

Re: OliThink 5.4.0 has been published with an big leap in strength for only 3 lines of code

Post by OliverBr » Sat Jun 20, 2020 11:50 am

To be fair, Fruit still wins most of the games, especially with larger time control.

PS: Thank you for the pocket Hercules link :o
Chess Engine OliThink: http://brausch.org/home/chess
OliThink GitHub:https://github.com/olithink

Post Reply