projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Get rid of redundant variable variantRules.movesCount
[vchess.git]
/
public
/
javascripts
/
variants
/
Checkered.js
diff --git
a/public/javascripts/variants/Checkered.js
b/public/javascripts/variants/Checkered.js
index
7c00cca
..
3626822
100644
(file)
--- a/
public/javascripts/variants/Checkered.js
+++ b/
public/javascripts/variants/Checkered.js
@@
-276,8
+276,8
@@
class CheckeredRules extends ChessRules
canIplay(color, sq)
{
canIplay(color, sq)
{
- return ((color=='w' && this.moves
Count
%2==0) || color=='c'
- || (color=='b' && this.moves
Count
%2==1))
+ return ((color=='w' && this.moves
.length
%2==0) || color=='c'
+ || (color=='b' && this.moves
.length
%2==1))
&& [color,'c'].includes(this.getColor(sq[0], sq[1]));
}
&& [color,'c'].includes(this.getColor(sq[0], sq[1]));
}
@@
-385,19
+385,6
@@
class CheckeredRules extends ChessRules
this.flags[1][move.start.x==6 ? "w" : "b"][move.start.y] = false;
}
this.flags[1][move.start.x==6 ? "w" : "b"][move.start.y] = false;
}
- play(move, ingame)
- {
- super.play(move, ingame);
- if (!ingame)
- this.moves.push(move); //needed for turn indication for checkered pieces
- }
-
- undo(move)
- {
- super.undo(move);
- this.moves.pop();
- }
-
checkGameEnd(color)
{
if (!this.isAttacked(this.kingPos[color], this.getOppCol(color))
checkGameEnd(color)
{
if (!this.isAttacked(this.kingPos[color], this.getOppCol(color))