File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11cmake_minimum_required (VERSION 3.20 )
2- project (bread_engine VERSION 1.3.9 )
2+ project (bread_engine VERSION 1.4.0 )
33
44set (CMAKE_CXX_STANDARD 20)
55set (CMAKE_CXX_STANDARD_REQUIRED True )
Original file line number Diff line number Diff line change @@ -164,13 +164,17 @@ void SortedMoveGen<chess::movegen::MoveGenType::ALL>::clear_killer_moves(){
164164}
165165
166166template <>
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}
You can’t perform that action at this time.
0 commit comments