projects
/
vchess.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5bfb095
)
Probably fixed Magnetic chess
author
Benjamin Auder
<benjamin.auder@somewhere>
Thu, 22 Nov 2018 01:14:17 +0000
(
02:14
+0100)
committer
Benjamin Auder
<benjamin.auder@somewhere>
Thu, 22 Nov 2018 01:14:17 +0000
(
02:14
+0100)
public/javascripts/base_rules.js
patch
|
blob
|
blame
|
history
public/javascripts/components/game.js
patch
|
blob
|
blame
|
history
public/javascripts/variants/Magnetic.js
patch
|
blob
|
blame
|
history
diff --git
a/public/javascripts/base_rules.js
b/public/javascripts/base_rules.js
index
d638067
..
e757f7a
100644
(file)
--- a/
public/javascripts/base_rules.js
+++ b/
public/javascripts/base_rules.js
@@
-1035,7
+1035,8
@@
class ChessRules
else
{
// Piece movement
else
{
// Piece movement
- return piece.toUpperCase() + (move.vanish.length > 1 ? "x" : "") + finalSquare;
+ return piece.toUpperCase() +
+ (move.vanish.length > move.appear.length ? "x" : "") + finalSquare;
}
}
}
}
diff --git
a/public/javascripts/components/game.js
b/public/javascripts/components/game.js
index
5ad33d0
..
5690eb1
100644
(file)
--- 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) {
this.newGame("computer");
},
newGame: function(mode, fenInit, color, oppId, moves, continuation) {
- const fen =
"rbnqknbr/pppppppp/8/8/8/8/PPPPPPPP/BQRKNNRB 1111";//
fenInit || VariantRules.GenRandInitFen();
+ const fen = fenInit || VariantRules.GenRandInitFen();
console.log(fen); //DEBUG
this.score = "*";
if (mode=="human" && !oppId)
console.log(fen); //DEBUG
this.score = "*";
if (mode=="human" && !oppId)
@@
-634,7
+634,7
@@
Vue.component('my-game', {
}
else //against computer
{
}
else //against computer
{
- this.mycolor =
"w";//
Math.random() < 0.5 ? 'w' : 'b';
+ this.mycolor = Math.random() < 0.5 ? 'w' : 'b';
if (this.mycolor == 'b')
setTimeout(this.playComputerMove, 500);
}
if (this.mycolor == 'b')
setTimeout(this.playComputerMove, 500);
}
@@
-672,7
+672,7
@@
Vue.component('my-game', {
this.selectedPiece.style.display = "inline-block";
this.selectedPiece.style.zIndex = 3000;
let startSquare = this.getSquareFromId(e.target.parentNode.id);
this.selectedPiece.style.display = "inline-block";
this.selectedPiece.style.zIndex = 3000;
let startSquare = this.getSquareFromId(e.target.parentNode.id);
- this.possibleMoves = t
rue //t
his.mode!="idle" && this.vr.canIplay(this.mycolor,startSquare)
+ this.possibleMoves = this.mode!="idle" && this.vr.canIplay(this.mycolor,startSquare)
? this.vr.getPossibleMovesFrom(startSquare)
: [];
console.log(this.possibleMoves);
? this.vr.getPossibleMovesFrom(startSquare)
: [];
console.log(this.possibleMoves);
diff --git
a/public/javascripts/variants/Magnetic.js
b/public/javascripts/variants/Magnetic.js
index
4c286e1
..
7fecf78
100644
(file)
--- a/
public/javascripts/variants/Magnetic.js
+++ b/
public/javascripts/variants/Magnetic.js
@@
-14,7
+14,7
@@
class MagneticRules extends ChessRules
if (newMove_s.length == 1)
moves.push(newMove_s[0]);
else //promotion
if (newMove_s.length == 1)
moves.push(newMove_s[0]);
else //promotion
- moves = moves.concat(
moves,
newMove_s);
+ moves = moves.concat(newMove_s);
});
return moves;
}
});
return moves;
}