From: Benjamin Auder Date: Wed, 21 Nov 2018 16:28:39 +0000 (+0100) Subject: Saving state - unstable X-Git-Url: https://git.auder.net/variants/Chakart/doc/css/current/scripts/mini-custom.min.css?a=commitdiff_plain;h=5bfb09560aa346d132e829a7c63558407bcc8091;p=vchess.git Saving state - unstable --- diff --git a/public/javascripts/base_rules.js b/public/javascripts/base_rules.js index 5b0d5d1e..d6380675 100644 --- a/public/javascripts/base_rules.js +++ b/public/javascripts/base_rules.js @@ -1019,7 +1019,7 @@ class ChessRules { // Pawn move let notation = ""; - if (move.vanish.length > 1) + if (move.vanish.length > move.appear.length) { // Capture let startColumn = String.fromCharCode(97 + move.start.y); diff --git a/public/javascripts/components/game.js b/public/javascripts/components/game.js index 74092b56..5ad33d07 100644 --- a/public/javascripts/components/game.js +++ b/public/javascripts/components/game.js @@ -574,7 +574,7 @@ Vue.component('my-game', { this.newGame("computer"); }, newGame: function(mode, fenInit, color, oppId, moves, continuation) { - const fen = fenInit || VariantRules.GenRandInitFen(); + const fen = "rbnqknbr/pppppppp/8/8/8/8/PPPPPPPP/BQRKNNRB 1111";//fenInit || VariantRules.GenRandInitFen(); console.log(fen); //DEBUG this.score = "*"; if (mode=="human" && !oppId) @@ -672,9 +672,10 @@ Vue.component('my-game', { this.selectedPiece.style.display = "inline-block"; this.selectedPiece.style.zIndex = 3000; let startSquare = this.getSquareFromId(e.target.parentNode.id); - this.possibleMoves = this.mode!="idle" && this.vr.canIplay(this.mycolor,startSquare) + this.possibleMoves = true //this.mode!="idle" && this.vr.canIplay(this.mycolor,startSquare) ? this.vr.getPossibleMovesFrom(startSquare) : []; + console.log(this.possibleMoves); e.target.parentNode.appendChild(this.selectedPiece); } }, diff --git a/public/javascripts/variants/Alice.js b/public/javascripts/variants/Alice.js new file mode 100644 index 00000000..673af088 --- /dev/null +++ b/public/javascripts/variants/Alice.js @@ -0,0 +1,7 @@ +class AliceRules extends ChessRUles +{ + getPpath(b) + { + return ""; //TODO + } +} diff --git a/public/javascripts/variants/Checkered.js b/public/javascripts/variants/Checkered.js index 56fa15a3..f1cf771f 100644 --- a/public/javascripts/variants/Checkered.js +++ b/public/javascripts/variants/Checkered.js @@ -1,6 +1,5 @@ class CheckeredRules extends ChessRules { - // Path to pieces static getPpath(b) { return b[0]=='c' ? "Checkered/"+b : b; diff --git a/public/javascripts/variants/Magnetic.js b/public/javascripts/variants/Magnetic.js index d6cf918c..4c286e1d 100644 --- a/public/javascripts/variants/Magnetic.js +++ b/public/javascripts/variants/Magnetic.js @@ -20,6 +20,7 @@ class MagneticRules extends ChessRules } // Complete a move with magnetic actions + // TODO: job is done multiple times for (normal) promotions. applyMagneticLaws(move) { const V = VariantRules; @@ -43,8 +44,7 @@ class MagneticRules extends ChessRules if (this.getColor(i,j) != color) { // Attraction - if ((Math.abs(i-x)>=2 || Math.abs(j-y)>=2) - && this.getPiece(i,j) != V.KING) + if ((Math.abs(i-x)>=2 || Math.abs(j-y)>=2) && this.getPiece(i,j) != V.KING) { move.vanish.push( new PiPo({