X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FSwap.js;h=167adeae7e32e2c04b568cbb4ea7d02060a1a864;hb=f52671e5b5b50b1421474f27dc9c18f701b559f3;hp=9c3407b7351cd91e4137a20506d4921f84f07ff6;hpb=7301aa5ff93c6b0cf6b2c41a24d552597b689693;p=vchess.git diff --git a/client/src/variants/Swap.js b/client/src/variants/Swap.js index 9c3407b7..167adeae 100644 --- a/client/src/variants/Swap.js +++ b/client/src/variants/Swap.js @@ -270,28 +270,8 @@ export class SwapRules extends ChessRules { const color = this.turn; const oppCol = V.GetOppCol(this.turn); - // Search best (half) move for opponent turn (TODO: a bit too slow) -// const getBestMoveEval = () => { -// let score = this.getCurrentScore(); -// if (score != "*") return maxeval * (score == "1-0" ? 1 : -1); -// let moves = this.getAllValidMoves(); -// let res = (oppCol == "w" ? -maxeval : maxeval); -// for (let m of moves) { -// this.play(m); -// score = this.getCurrentScore(); -// // Now turn is oppCol,2 if m allow a swap and movesCount >= 2 -// // Otherwise it's color,1. In both cases the next test makes sense -// if (score != "*") { -// // Game over -// this.undo(m); -// return maxeval * (score == "1-0" ? 1 : -1); -// } -// const evalPos = this.evalPosition(); -// res = oppCol == "w" ? Math.max(res, evalPos) : Math.min(res, evalPos); -// this.undo(m); -// } -// return res; -// }; + // NOTE: searching best (half) move for opponent turn is a bit too slow. + // => Only 2 half moves depth here. const moves11 = this.getAllValidMoves(); if (this.movesCount == 0) @@ -312,7 +292,6 @@ export class SwapRules extends ChessRules { let moves12 = this.getAllValidMoves(); for (let j = 0; j < moves12.length; j++) { this.play(moves12[j]); -// const evalMove = getBestMoveEval() + 0.05 - Math.random() / 10; const evalMove = this.evalPosition() + 0.05 - Math.random() / 10; if ( !bestMove ||