Skip to content

Commit 6ad42ce

Browse files
committed
improve history
Results of bread_engine_1.4.0 vs bread_engine_1.3.9 (10+0.1, 1t, MB, UHO_2024_8mvs_big_+115_+134.pgn): Elo: 23.38 +/- 13.67, nElo: 31.41 +/- 18.30 LOS: 99.96 %, DrawRatio: 40.17 %, PairsRatio: 1.41 Games: 1384, Wins: 524, Losses: 431, Draws: 429, Points: 738.5 (53.36 %) Ptnml(0-2): [49, 123, 278, 170, 72] LLR: 2.99 (-2.94, 2.94) [0.00, 10.00] Bench: 3860875
1 parent e757ed7 commit 6ad42ce

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.20)
2-
project(bread_engine VERSION 1.3.9)
2+
project(bread_engine VERSION 1.4.0)
33

44
set(CMAKE_CXX_STANDARD 20)
55
set(CMAKE_CXX_STANDARD_REQUIRED True)

src/sorted_move_gen.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,17 @@ void SortedMoveGen<chess::movegen::MoveGenType::ALL>::clear_killer_moves(){
164164
}
165165

166166
template<>
167-
void SortedMoveGen<chess::movegen::MoveGenType::ALL>::update_history(chess::Move move, int depth, bool color){
167+
void SortedMoveGen<chess::movegen::MoveGenType::ALL>::update_history(chess::Move best_move, int depth, bool color){
168168
int bonus = std::min(depth*depth*32 + 20, 1000);
169+
int idx = best_move.from().index()*64 + best_move.to().index();
170+
171+
if (!board.isCapture(best_move))
172+
history.history[color][idx] += (bonus - history.history[color][idx] * std::abs(bonus) / MAX_HISTORY_BONUS);
173+
169174
for (int i = 0; i < generated_moves_count; i++){
170-
if (moves_[i] == move){
171-
history.history[color][move.from().index()*64 + move.to().index()] += (bonus - history.history[color][move.from().index()*64 + move.to().index()] * std::abs(bonus) / MAX_HISTORY_BONUS);
172-
} else {
173-
if (!board.isCapture(moves_[i])) history.history[color][moves_[i].from().index()*64 + moves_[i].to().index()] += -bonus/generated_moves_count - history.history[color][moves_[i].from().index()*64 + moves_[i].to().index()] * std::abs(bonus/generated_moves_count) / MAX_HISTORY_BONUS;
175+
if (moves_[i] != best_move && !board.isCapture(moves_[i])){
176+
idx = moves_[i].from().index()*64 + moves_[i].to().index();
177+
history.history[color][idx] += -bonus - history.history[color][idx] * std::abs(bonus) / MAX_HISTORY_BONUS;
174178
}
175179
}
176180
}

0 commit comments

Comments
 (0)