Skip to content

Commit 2de7045

Browse files
author
Oliver Brausch
committed
5.11.2 Small adaptions in mobility eval and time control
1 parent 1c908c5 commit 2de7045

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

src/Readme.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
OliThink5 (c) Oliver Brausch 04.Mai.2025, ob112@web.de, http://brausch.org
1+
OliThink5 (c) Oliver Brausch 12.Mai.2025, ob112@web.de, http://brausch.org
22

3-
Version: 5.11.1
3+
Version: 5.11.2
44
Protocol: CECP v2 (winboard/xboard)
55
HashSize: 128MB
66
Ponder: Yes
@@ -9,10 +9,13 @@ EndgameTables: No
99
AnalyzeMode: Basic
1010
SearchMethods: Nullmove, Internal Iterative Reduction, Check Extension, LMR
1111
Evaluation: Just mobility and a very simple pawnprogressing evaluation
12-
LinesOfCode: 1337
12+
LinesOfCode: 1336
1313
Stability: 100%
1414
Special thanks to Dann Corbit for his support and contribution.
1515

16+
v5.11.2: changes since 5.11.1:
17+
Small adaptions in mobility eval and time control
18+
1619
v5.11.1: changes since 5.11.0:
1720
Minor refactoring and adaptions yielding better results
1821

src/olithink.c

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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];
102102
static u64 pmoves[2][64],pawnprg[2][64], pawnfree[2][64], pawnfile[2][64], pawnhelp[2][64], RANK[2][64], pcaps[2][192];
103103
static u64 BIT[64], nmoves[64], kmoves[64], bmask135[64], bmask45[64];
104104
static 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;
106106
static u32 crevoke[64], count, flags, ics = 0, ponder = 0, pondering = 0, analyze = 0;
107107
static Move pv[128][128], pon = 0, bkmove[BKSIZE*32], killer[128];
108108
static 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. */
754754
int 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

817817
int 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

900898
const 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

Comments
 (0)