- this.play(moves1[i]);
- // 0.1 * oldEval : heuristic to avoid some bad moves (not all...)
- moves1[i].eval = 0.1*moves1[i].eval + this.alphabeta(2, -1000, 1000);
- this.undo(moves1[i]);
+ // TODO: show current analyzed move for depth 3, allow stopping eval (return moves1[0])
+ 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.alphabeta(2, -maxeval, maxeval);
+ this.undo(moves1[i]);
+ }
+ moves1.sort( (a,b) => { return (color=="w" ? 1 : -1) * (b.eval - a.eval); });