Skip to content

Commit

Permalink
Fixed an issue with repetition detection, adjusted time management.
Browse files Browse the repository at this point in the history
  • Loading branch information
konsolas committed Jun 29, 2018
1 parent b8c562a commit 0c0e25a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "eval.h"
#include "endgame.h"

#define TOPPLE_VER "0.1.1"
#define TOPPLE_VER "0.1.2"

const unsigned int MB = 1048576;

Expand Down Expand Up @@ -123,11 +123,11 @@ int main(int argc, char *argv[]) {
if (board->is_pseudo_legal(move)) {
board->move(move);
if (board->is_illegal()) {
std::cout << "illegal move: " << move << std::endl;
std::cout << "illegal move: " << move_str << std::endl;
board->unmove();
}
} else {
std::cout << "invalid move: " << move << std::endl;
std::cout << "invalid move: " << move_str << std::endl;
}
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ void search_t::save_pv() {
}

bool search_t::has_pv() {
return last_pv[0] != EMPTY_MOVE && last_pv_len > 1;
return last_pv[0] != EMPTY_MOVE && last_pv_len > 0;
}

bool search_t::keep_searching(int depth) {
Expand Down
4 changes: 2 additions & 2 deletions search.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@ struct search_limits_t {
{
// Try and use a consistent amount of time per move
time_limit = (time /
(moves_to_go > 0 ? moves_to_go + 1: std::max(60 - now, 40)));
(moves_to_go > 0 ? moves_to_go + 1: std::max(50 - now, 30)));

// Handle increment: Look to gain some time if there isn't much left
time_limit += inc / 2;

// Add a 25ms buffer to prevent losses from timeout.
time_limit = std::min(time_limit, time - 25);
time_limit = std::min(time_limit, time - 50);

// Ensure time is valid (if a time of zero is given, search will be depth 1)
time_limit = std::max(time_limit, 0);
Expand Down

0 comments on commit 0c0e25a

Please sign in to comment.