Skip to content

Commit

Permalink
save limit to table and ignore 1 node evals unless limit was actually 1
Browse files Browse the repository at this point in the history
  • Loading branch information
rooklift committed Dec 13, 2021
1 parent f490e18 commit c6d3cc9
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/50_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const table_prototype = {
this.nps = 0; // Stat sent by engine
this.tbhits = 0; // Stat sent by engine
this.time = 0; // Stat sent by engine
this.limit = null; // The limit of the last search that updated this.
this.terminal = null; // null = unknown, "" = not terminal, "Non-empty string" = terminal reason
this.eval = null; // Used by grapher only, value from White's POV
this.eval_version = 0; // Which version (above) was used to generate the eval
Expand All @@ -28,7 +29,7 @@ const table_prototype = {
return this.eval;
} else {
let info = SortedMoveInfoFromTable(this)[0];
if (info && !info.__ghost && info.__touched) {
if (info && !info.__ghost && info.__touched && (this.nodes > 1 || this.limit === 1)) {
this.eval = info.board.active === "w" ? info.value() : 1 - info.value();
} else {
this.eval = null;
Expand Down
6 changes: 5 additions & 1 deletion src/80_info.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ let info_receiver_props = {
}
},

receive: function(engine, node, s) {
receive: function(engine, search, s) {

let node = search.node;

if (typeof s !== "string" || !node || node.destroyed) {
return;
Expand Down Expand Up @@ -152,6 +154,7 @@ let info_receiver_props = {
this.engine_sent_info = true; // After the move legality check; i.e. we want REAL info
this.ever_updated_a_table = true;
node.table.version++;
node.table.limit = search.limit;

move_info.cycle = this.engine_cycle;
move_info.__touched = true;
Expand Down Expand Up @@ -294,6 +297,7 @@ let info_receiver_props = {
this.engine_sent_info = true; // After the move legality check; i.e. we want REAL info
this.ever_updated_a_table = true;
node.table.version++;
node.table.limit = search.limit;

// move_info.cycle = this.engine_cycle; // No... we get VMS lines even when excluded by searchmoves.
// move_info.subcycle = this.engine_subcycle;
Expand Down
2 changes: 1 addition & 1 deletion src/90_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ function NewEngine(hub) {
return;
}

this.hub.info_handler.receive(this, this.search_running.node, line); // Responsible for logging lines that get this far.
this.hub.info_handler.receive(this, this.search_running, line); // Responsible for logging lines that get this far.
};

eng.setoption = function(name, value) {
Expand Down
2 changes: 1 addition & 1 deletion src/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Nibbler",
"version": "2.2.4",
"version": "2.2.5",
"author": "Rooklift",
"description": "Leela Chess Zero (Lc0) interface",
"license": "GPL-3.0",
Expand Down

0 comments on commit c6d3cc9

Please sign in to comment.