X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FDynamo.js;h=91920e074e3eb9c835ca31a714ccb7e7485bc810;hb=156986e6b06dc5f0acd39860bd4fef6b030e263b;hp=f7d602405cffd8080d999795d52bba08b9bc58e9;hpb=8c267d0c700050831a10d0934df1d1606aa0d654;p=vchess.git diff --git a/client/src/variants/Dynamo.js b/client/src/variants/Dynamo.js index f7d60240..91920e07 100644 --- a/client/src/variants/Dynamo.js +++ b/client/src/variants/Dynamo.js @@ -88,7 +88,7 @@ export class DynamoRules extends ChessRules { return ( ["appear","vanish"].map( mpart => { - if (mpart.length == 0) return "-"; + if (this.amoves[L-1][mpart].length == 0) return "-"; return ( this.amoves[L-1][mpart].map( av => { @@ -479,6 +479,22 @@ export class DynamoRules extends ChessRules { return false; } + // No consideration of color: all pieces could be played + getAllPotentialMoves() { + let potentialMoves = []; + for (let i = 0; i < V.size.x; i++) { + for (let j = 0; j < V.size.y; j++) { + if (this.board[i][j] != V.EMPTY) { + Array.prototype.push.apply( + potentialMoves, + this.getPotentialMovesFrom([i, j]) + ); + } + } + } + return potentialMoves; + } + getCurrentScore() { if (this.subTurn == 2) // Move not over