heuristicWeight info on docs is incorrect
tcdejong opened this issue · 1 comments
tcdejong commented
Summary
At both occurences in the API reference, heuristicWeight
is said to be 1.2 per default.
You can see this at:
However, the default is actually 1.0.
Engine showing the default is 1.0
https://github.com/screeps/driver/blob/master/lib/runtime/path-finder.js#L68
Trial showing the default is 1.0
const start = new RoomPosition(38, 6, "W1N4");
const stop = new RoomPosition(8, 41, "W1N4");
const { ops, cost, incomplete } = PathFinder.search(start, stop, {range: 0, maxOps: 10000 });
const tmp = { ops, cost, incomplete };
console.log(JSON.stringify(tmp))
// No heuristicWeight opt configured
// => [2:28:41 PM] [shard3]{"ops":78,"cost":41,"incomplete":false}
const { ops, cost, incomplete } = PathFinder.search(start, stop, {range: 0, maxOps: 10000, heuristicWeight: 1.2 });
const tmp = { ops, cost, incomplete };
console.log(JSON.stringify(tmp))
// If default is 1.2, this should be the same as above. It's not.
// => [2:28:52 PM] [shard3]{"ops":62,"cost":41,"incomplete":false}
const { ops, cost, incomplete } = PathFinder.search(start, stop, {range: 0, maxOps: 10000, heuristicWeight: 1.0 });
const tmp = { ops, cost, incomplete };
console.log(JSON.stringify(tmp))
// heuristicWeight 1.0 matches the call without this opt
// => [2:28:59 PM] [shard3]{"ops":78,"cost":41,"incomplete":false}```
o4kapuk commented
Thanks for the report, the documentation is fixed.