Skip to content

Commit

Permalink
Tidy up evaluation parameters and bump version to 0.7.5
Browse files Browse the repository at this point in the history
  • Loading branch information
konsolas committed Feb 16, 2020
1 parent 786da4f commit 2ce25ac
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 17 deletions.
7 changes: 3 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.9)
project(Topple)

set(CMAKE_CXX_STANDARD 17)
set(TOPPLE_VERSION 0.7.5_dev)
set(TOPPLE_VERSION 0.7.5)

# Source files for different targets
set(SOURCE_FILES
Expand All @@ -27,13 +27,12 @@ set(TEST_FILES testing/catch.hpp testing/runner.cpp testing/util.h testing/util.
testing/tests/test_hash.cpp)
set(TUNE_FILES tuning/tunemain.cpp tuning/tuner.cpp tuning/tuner.h)

set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)

# Add version definitions
add_definitions(-DTOPPLE_VER="${TOPPLE_VERSION}")

add_executable(Topple ${SOURCE_FILES} main.cpp)
add_executable(ToppleTest ${SOURCE_FILES} ${TEST_FILES})
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
add_executable(Topple ${SOURCE_FILES} main.cpp)
add_executable(ToppleTune ${SOURCE_FILES} ${TUNE_FILES})

# Link pthreads on linux
Expand Down
66 changes: 53 additions & 13 deletions eval.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,44 +32,84 @@ struct eval_params_t {
// A1, B1, C1, D1
// Horizontal, Vertical and diagonal symmetry
int n_pst_mg[16] = {
404, 421, 429, 432, 387, 413, 422, 427, 387, 385, 396, 415, 275, 372, 393, 387,
404, 421, 429, 432,
387, 413, 422, 427,
387, 385, 396, 415,
275, 372, 393, 387,
};
int n_pst_eg[16] = {
375, 378, 383, 388, 372, 381, 386, 390, 362, 380, 383, 381, 312, 364, 365, 379,
375, 378, 383, 388,
372, 381, 386, 390,
362, 380, 383, 381,
312, 364, 365, 379,
};
int q_pst_mg[16] = {
1318, 1321, 1316, 1310, 1333, 1329, 1324, 1315, 1326, 1315, 1327, 1331, 1327, 1318, 1314, 1328,
1318, 1321, 1316, 1310,
1333, 1329, 1324, 1315,
1326, 1315, 1327, 1331,
1327, 1318, 1314, 1328,
};
int q_pst_eg[16] = {
1255, 1271, 1266, 1298, 1219, 1253, 1275, 1274, 1228, 1246, 1243, 1249, 1201, 1223, 1239, 1227,
1255, 1271, 1266, 1298,
1219, 1253, 1275, 1274,
1228, 1246, 1243, 1249,
1201, 1223, 1239, 1227,
};
int b_pst_mg[16] = {
412, 406, 420, 426, 427, 438, 435, 430, 425, 438, 435, 429, 408, 432, 412, 413,
412, 406, 420, 426,
427, 438, 435, 430,
425, 438, 435, 429,
408, 432, 412, 413,
};
int b_pst_eg[16] = {
382, 388, 383, 377, 378, 385, 387, 389, 364, 378, 375, 386, 376, 376, 383, 390,
382, 388, 383, 377,
378, 385, 387, 389,
364, 378, 375, 386,
376, 376, 383, 390,
};
int r_pst_mg[16] = {
572, 578, 570, 576, 579, 591, 577, 580, 573, 577, 576, 583, 580, 585, 590, 591,
572, 578, 570, 576,
579, 591, 577, 580,
573, 577, 576, 583,
580, 585, 590, 591,
};
int r_pst_eg[16] = {
679, 673, 678, 673, 672, 671, 677, 671, 684, 689, 688, 686, 688, 680, 682, 676,
679, 673, 678, 673,
672, 671, 677, 671,
684, 689, 688, 686,
688, 680, 682, 676,
};
// Pawns have first and eighth rank excluded
int p_pst_mg[24] = {
205, 158, 149, 121, 132, 145, 133, 135, 110, 108, 99, 99, 106, 100, 100, 111, 94, 83, 96, 88, 95, 94, 101, 86
205, 158, 149, 121,
132, 145, 133, 135,
110, 108, 99, 99,
106, 100, 100, 111,
94, 83, 96, 88,
95, 94, 101, 86
};
int p_pst_eg[24] = {
184, 204, 206, 183, 122, 138, 133, 111, 109, 113, 114, 104, 103, 105, 104, 95, 99, 100, 94, 92, 98, 98, 92, 86,
184, 204, 206, 183,
122, 138, 133, 111,
109, 113, 114, 104,
103, 105, 104, 95,
99, 100, 94, 92,
98, 98, 92, 86,
};

// PST for king
// Horizontal, Vertical and diagonal symmetry, like N and Q
int k_pst_mg[16] = {
-55, -80, -51, -73, 26, -10, -23, -46, 29, -15, -58, -80, 54, 37, 26, 0,
-55, -80, -51, -73,
26, -10, -23, -46,
29, -15, -58, -80,
54, 37, 26, 0,
};
int k_pst_eg[16] = {
8, 30, 24, 24, 6, 20, 17, 18, -13, 4, 17, 21, -42, -19, -2, 3,
8, 30, 24, 24,
6, 20, 17, 18,
-13, 4, 17, 21,
-42, -19, -2, 3,
};

/// Pawn structure
Expand Down Expand Up @@ -193,7 +233,7 @@ class alignas(64) evaluator_t {
U64 double_attacks[2];

void update_attacks(Team team, Piece piece, U64 bb) {
double_attacks[team] = team_attacks[team] & bb;
double_attacks[team] |= team_attacks[team] & bb;
attacks[team][piece] |= bb;
team_attacks[team] |= bb;
}
Expand Down

0 comments on commit 2ce25ac

Please sign in to comment.