From: Benjamin Auder Date: Wed, 28 Nov 2018 16:28:13 +0000 (+0100) Subject: Fixed Crazyhouse; still have to keep track of promoted pawns X-Git-Url: https://git.auder.net/%7B%7B%20asset%28%27mixstore/css/static/doc/current/git-favicon.png?a=commitdiff_plain;h=5c42c64e0b43ad4d687c58a6b7e9b9ac5d212e17;p=vchess.git Fixed Crazyhouse; still have to keep track of promoted pawns --- diff --git a/TODO b/TODO index fe7d8473..58906a83 100644 --- a/TODO +++ b/TODO @@ -4,3 +4,4 @@ setInterval "CRON" task in sockets.js to check connected clients (every 1hour maybe, or more) Systematically show init+dest squares in PGN, maybe after short notation (2 moves list, second for de-ambiguification) +Crazyhouse: keep track of promoted pawns. diff --git a/public/javascripts/components/game.js b/public/javascripts/components/game.js index 2897b1cd..f5bef8ef 100644 --- a/public/javascripts/components/game.js +++ b/public/javascripts/components/game.js @@ -240,38 +240,75 @@ Vue.component('my-game', { ); } elementArray.push(gameDiv); - if (!!this.vr.reserve) //TODO: table, show counts for reserve pieces - // - // 3 + if (!!this.vr.reserve) { - let reservePiecesArray = []; + let myReservePiecesArray = []; for (let i=0; i give a pawn if captured. + } + + getColor(i,j) + { + const sizeX = VariantRules.size[0]; + if (i >= sizeX) + return (i==sizeX ? "w" : "b"); + return this.board[i][j].charAt(0); + } + getPiece(i,j) + { + const sizeX = VariantRules.size[0]; + if (i >= sizeX) + return VariantRules.RESERVE_PIECES[j]; + return this.board[i][j].charAt(1); } // Used by the interface: @@ -52,11 +68,13 @@ class CrazyhouseRules extends ChessRules if (this.reserve[color][p] == 0) return []; let moves = []; - for (let i=0; i