1- /* OliThink5 (c) Oliver Brausch 03 .Jun.2021, ob112@web.de, http://brausch.org */
2- #define VER "5.9.7 "
1+ /* OliThink5 (c) Oliver Brausch 06 .Jun.2021, ob112@web.de, http://brausch.org */
2+ #define VER "5.9.8 "
33#include <stdio.h>
44#include <string.h>
55#ifdef _WIN64
@@ -28,7 +28,6 @@ enum { NOPE, HASH, NOISY, QUIET, EXIT };
2828#define CNODES 0x1FFF
2929const int pval [] = {0 , 100 , 290 , 0 , 100 , 310 , 500 , 980 };
3030const int fval [] = {0 , 0 , 2 , 0 , 0 , 3 , 5 , 9 };
31- const int pawnrun [] = {0 , 0 , 1 , 8 , 16 , 32 , 64 , 128 };
3231
3332#define FROM (x ) ((x) & 63)
3433#define TO (x ) (((x) >> 6) & 63)
@@ -243,7 +242,7 @@ void _init_pawns(u64* moves, u64* caps, u64* freep, u64* filep, u64* helpp, int
243242 for (i = 0 ; i < 64 ; i ++ ) {
244243 int rank = i /8 , file = i & 7 ;
245244 int m = i + (c ? -8 : 8 );
246- pawnprg [i + (c << 6 )] = pawnrun [ c ? 7 - rank : rank ] ;
245+ pawnprg [i + (c << 6 )] = 1 << ( c ? 7 - rank : rank ) ;
247246 for (j = 0 ; j < 64 ; j ++ ) {
248247 int jrank = j /8 , jfile = j & 7 ;
249248 int dfile = (jfile - file )* (jfile - file );
@@ -776,11 +775,11 @@ Move qpick(Movep* mp, int s) {
776775}
777776
778777Move killer [128 ];
779- long long history [0x2000 ];
778+ int history [0x2000 ];
780779/* In normal search some basic move ordering heuristics are used */
781780Move spick (Movep * mp , int s , int ply ) {
782781 Move m ;
783- int i , pi = 0 ; long long vmax = - (1LL << 62 );
782+ int i , pi = 0 , vmax = - (1 << 15 );
784783 for (i = s ; i < mp -> n ; i ++ ) {
785784 m = mp -> list [i ];
786785 if (m == killer [ply ]) {
@@ -1063,7 +1062,7 @@ int search(u64 ch, int c, int d, int ply, int alpha, int beta, int null, Move se
10631062 Movep mp ; mp .nquiet = 0 ;
10641063 Pos pos ; pos .hashb = 0 ;
10651064 int raising = !ch && ply >= 2 && wstat >= wstack [COUNT - 2 ];
1066- int first = NO_MOVE ; long long hismax = -1LL ;
1065+ int first = NO_MOVE , hismax = -1 ;
10671066 for (n = HASH ; n <= (ch ? NOISY : QUIET ); n ++ ) {
10681067 int nd = d - 1 ;
10691068 if (n == HASH ) {
@@ -1099,7 +1098,7 @@ int search(u64 ch, int c, int d, int ply, int alpha, int beta, int null, Move se
10991098 if (m == killer [ply ]); //Don't reduce killers
11001099 else if (PIECE (m ) == PAWN && !(pawnfree [TO (m ) + (c << 6 )] & pieceb [PAWN ] & colorb [oc ])); //Free pawns
11011100 else {
1102- long long his = history [m & 0x1FFF ];
1101+ int his = history [m & 0x1FFF ];
11031102 if (his > hismax ) hismax = his ;
11041103 else if (d < 6 && (his < -1 || his * his < hismax )) { undoMove (0 , c ); restorePos (& pos , c ); continue ; }
11051104 else if (d >= 2 ) ext -= (d + 1 )/3 ;
@@ -1125,11 +1124,11 @@ int search(u64 ch, int c, int d, int ply, int alpha, int beta, int null, Move se
11251124 if (quiet ) {
11261125 int his = MIN (d * d , 512 );
11271126 killer [ply ] = m ;
1128- history [m & 0x1FFF ] += his ;
1127+ history [m & 0x1FFF ] += his - history [ m & 0x1FFF ] * his / 512 ;
11291128
11301129 for (j = 0 ; j < mp .nquiet ; j ++ ) {
11311130 Move m2 = mp .quiets [j ];
1132- if (m2 != m ) history [m2 & 0x1FFF ] -= his ;
1131+ if (m2 != m ) history [m2 & 0x1FFF ] += - his - history [ m2 & 0x1FFF ] * his / 512 ;
11331132 }
11341133 }
11351134 n = EXIT ; break ;
0 commit comments