const maxeval = VariantRules.INFINITY;
const color = this.turn;
// Some variants may show a bigger moves list to the human (Switching),
const maxeval = VariantRules.INFINITY;
const color = this.turn;
// Some variants may show a bigger moves list to the human (Switching),
// Skip depth 3+ if we found a checkmate (or if we are checkmated in 1...)
if (VariantRules.SEARCH_DEPTH >= 3
&& Math.abs(moves1[0].eval) < VariantRules.THRESHOLD_MATE)
{
for (let i=0; i<moves1.length; i++)
{
// Skip depth 3+ if we found a checkmate (or if we are checkmated in 1...)
if (VariantRules.SEARCH_DEPTH >= 3
&& Math.abs(moves1[0].eval) < VariantRules.THRESHOLD_MATE)
{
for (let i=0; i<moves1.length; i++)
{
this.play(moves1[i]);
// 0.1 * oldEval : heuristic to avoid some bad moves (not all...)
moves1[i].eval = 0.1*moves1[i].eval +
this.play(moves1[i]);
// 0.1 * oldEval : heuristic to avoid some bad moves (not all...)
moves1[i].eval = 0.1*moves1[i].eval +