1- /* OliThink5 (c) Oliver Brausch 04 .Mai.2025, ob112@web.de, http://brausch.org */
2- #define VER "5.11.1 "
1+ /* OliThink5 (c) Oliver Brausch 12 .Mai.2025, ob112@web.de, http://brausch.org */
2+ #define VER "5.11.2 "
33#include <stdio.h>
44#include <string.h>
55#ifdef _WIN64
@@ -102,7 +102,7 @@ static u64 hstack[0x400], mstack[0x400], hashxor[0x1000], rays[0x8000];
102102static u64 pmoves [2 ][64 ],pawnprg [2 ][64 ], pawnfree [2 ][64 ], pawnfile [2 ][64 ], pawnhelp [2 ][64 ], RANK [2 ][64 ], pcaps [2 ][192 ];
103103static u64 BIT [64 ], nmoves [64 ], kmoves [64 ], bmask135 [64 ], bmask45 [64 ];
104104static u64 rankb [8 ], fileb [8 ];
105- static u64 whitesq , centr , maxtime , starttime , eval1 , nodes , qnodes ;
105+ static u64 whitesq , centr , centr2 , maxtime , starttime , eval1 , nodes , qnodes ;
106106static u32 crevoke [64 ], count , flags , ics = 0 , ponder = 0 , pondering = 0 , analyze = 0 ;
107107static Move pv [128 ][128 ], pon = 0 , bkmove [BKSIZE * 32 ], killer [128 ];
108108static int wstack [0x400 ], history [0x2000 ];
@@ -749,7 +749,7 @@ int kmobilf(int c) {
749749 return sfo < 14 ? km : km * (16 - sfo ) /4 ;
750750}
751751
752- #define MOBILITY (a , mb ) (bitcnt(a) + bitcnt(a & mb))
752+ #define MOBILITY (a , mb ) (bitcnt(a) + bitcnt(a & mb) + bitcnt(a & mb & centr2) )
753753/* The eval for Color c. It's almost only mobility. */
754754int evalc (int c ) {
755755 int f , mn = 0 , katt = 0 , oc = c ^1 , egf = 10400 /(80 + P .sf [c ] + P .sf [oc ]) + random ;
@@ -761,7 +761,7 @@ int evalc(int c) {
761761 f = pullLsb (& b );
762762
763763 /* The only non-mobility eval is the detection of free pawns/hanging pawns */
764- int ppos = pawnprg [c ][f ] * egf * egf / 100 / 100 ;
764+ int ppos = pawnprg [c ][f ] * egf * egf / 96 / 96 ;
765765 if (!(pawnfree [c ][f ] & P .piece [PAWN ] & ocb )) ppos <<= 1 ; //Free run?
766766
767767 if (!(pawnhelp [c ][f ] & P .piece [PAWN ] & cb )) { // No support
@@ -789,7 +789,7 @@ int evalc(int c) {
789789 f = pullLsb (& b );
790790 a = BATT (f ) | RATT (f );
791791 if (a & kn ) katt += bitcnt (a & kn );
792- mn += MOBILITY (a , mb ) * egf * egf / 75 / 75 ;
792+ mn += MOBILITY (a , mb ) * egf * egf / 80 / 80 ;
793793 }
794794
795795 BOARD ^= RQU & ocb ; //Opposite Queen & Rooks don't block mobility for bishop
@@ -807,11 +807,11 @@ int evalc(int c) {
807807 f = pullLsb (& b );
808808 a = RATT (f );
809809 if (a & kn ) katt += bitcnt (a & kn );
810- mn += ( MOBILITY (a , mb ) << 1 ) * egf / 75 ;
810+ mn += MOBILITY (a , mb ) * egf / 40 ;
811811 }
812812
813813 BOARD = cb | ocb ;
814- return mn + kmobilf (c ) + katt * (P .sf [c ] + 3 ); //Reduce the bonus for attacking king squares
814+ return mn + kmobilf (c ) + katt * (P .sf [c ] + 2 ); //Adapt bonus for attacking king squares
815815}
816816
817817int eval (int c ) {
@@ -891,10 +891,8 @@ int isDraw(u64 hp, int nrep) {
891891 if (count >= 0x400 * 100 ) return 2 ; //100 plies
892892 for (i = COUNT - 2 ; i >= n ; i -= 2 )
893893 if (hstack [i ] == hp && ++ c == nrep ) return 1 ;
894- } else if (!(P .piece [PAWN ] | RQU )) { //Check for mating material
895- if (bitcnt (BOARD ) <= 3 ) return 3 ;
896894 }
897- return 0 ;
895+ return (! P . piece [ PAWN ] && ! RQU && bitcnt ( BOARD ) <= 3 ) ? 3 : 0 ; //Check for mating material
898896}
899897
900898const int nullvar [] = {13 , 43 , 149 , 519 , 1809 , 6311 , 22027 };
@@ -952,7 +950,7 @@ int search(u64 ch, int c, int d, int ply, int alpha, int beta, int null, Move se
952950 doMove (0 , c );
953951 w = - search (0LL , oc , d - R , ply + 1 , - beta , 1 - beta , 0 , 0 );
954952 undoMove (0 , c );
955- if (! sabort && w >= beta ) return beta ;
953+ if (w >= beta ) return beta ;
956954 }
957955
958956 if (d >= 4 && !hmove ) d -- ; // Internal Iterative Reduction (IIR)
@@ -1192,7 +1190,7 @@ int calc(int tm) {
11921190 if (pondering ) continue ;
11931191 if (d >= MAXSCORE - w ) break ;
11941192 if (t1 < searchtime || d == 1 ) continue ;
1195- if (bestm == pv [0 ][0 ] || t1 > searchtime * 2 ) break ;
1193+ if (bestm == pv [0 ][0 ] || t1 > searchtime * 3 ) break ;
11961194 }
11971195 if (analyze ) return 1 ;
11981196 pondering = 0 ;
@@ -1307,7 +1305,8 @@ int main(int argc, char **argv) {
13071305 _init_pawns (pmoves [0 ], pcaps [0 ], pawnfree [0 ], pawnfile [0 ], pawnhelp [0 ], pawnprg [0 ], 0 );
13081306 _init_pawns (pmoves [1 ], pcaps [1 ], pawnfree [1 ], pawnfile [1 ], pawnhelp [1 ], pawnprg [1 ], 1 );
13091307
1310- for (i = 0 ; i < 64 ; i ++ ) n = bitcnt (nmoves [i ]), kmobil [i ] = MAX (n , 3 ) << 3 , centr |= n >= 4 ? BIT [i ] : 0L ;
1308+ for (i = 0 ; i < 64 ; i ++ ) n = bitcnt (nmoves [i ]), kmobil [i ] = MAX (n , 3 ) << 3 ;
1309+ for (i = 0 ; i < 64 ; i ++ ) n = bitcnt (nmoves [i ]), centr |= n >= 4 ? BIT [i ] : 0L , centr2 |= n >= 8 ? BIT [i ] : 0L ;
13111310 for (i = 0 ; i < 32 ; i ++ ) bishcorn [i ] = bishcorn [63 - i ] = (i & 7 ) < 4 ? cornbase [(i & 7 ) + i /8 ] : - cornbase [7 - (i & 7 ) + i /8 ];
13121311 _newGame ();
13131312
0 commit comments