X-Git-Url: https://git.auder.net/?a=blobdiff_plain;ds=sidebyside;f=client%2Fsrc%2Fvariants%2FDark.js;h=6cf3b6787996314abc0ac38c0a0292db7ad50c59;hb=71ef1664983cd58db3c3bbfdf6cb7c362474e9a5;hp=3944ca16308c88d7d8f5258d0b9452e7a6be099b;hpb=e3e2cc443054cfb273b28b3ba46f559117c5ceae;p=vchess.git diff --git a/client/src/variants/Dark.js b/client/src/variants/Dark.js index 3944ca16..6cf3b678 100644 --- a/client/src/variants/Dark.js +++ b/client/src/variants/Dark.js @@ -223,19 +223,18 @@ export const VariantRules = class DarkRules extends ChessRules { // Can I take something ? If yes, do it if it seems good... if (move.vanish.length == 2 && move.vanish[1].c != color) { - //avoid castle + // OK this isn't a castling move const myPieceVal = V.VALUES[move.appear[0].p]; const hisPieceVal = V.VALUES[move.vanish[1].p]; - if (myPieceVal <= hisPieceVal) move.eval = hisPieceVal - myPieceVal + 2; - //favor captures + // Favor captures + if (myPieceVal <= hisPieceVal) move.eval = hisPieceVal - myPieceVal + 1; else { // Taking a pawn with minor piece, // or minor piece or pawn with a rook, // or anything but a queen with a queen, // or anything with a king. - // ==> Do it at random, although - // this is clearly inferior to what a human can deduce... - move.eval = Math.random() < 0.5 ? 1 : -1; + move.eval = hisPieceVal - myPieceVal; + //Math.random() < 0.5 ? 1 : -1; } } }