projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Start server implementation for correspondance play (early debug stage)
[vchess.git]
/
public
/
javascripts
/
variants
/
Zen.js
diff --git
a/public/javascripts/variants/Zen.js
b/public/javascripts/variants/Zen.js
index
b090a29
..
6a568db
100644
(file)
--- a/
public/javascripts/variants/Zen.js
+++ b/
public/javascripts/variants/Zen.js
@@
-1,7
+1,7
@@
class ZenRules extends ChessRules
{
// NOTE: enPassant, if enabled, would need to redefine carefully getEpSquare
class ZenRules extends ChessRules
{
// NOTE: enPassant, if enabled, would need to redefine carefully getEpSquare
- static get HasEnpassant { return false; }
+ static get HasEnpassant
()
{ return false; }
// TODO(?): some duplicated code in 2 next functions
getSlideNJumpMoves([x,y], steps, oneStep)
// TODO(?): some duplicated code in 2 next functions
getSlideNJumpMoves([x,y], steps, oneStep)
@@
-52,7
+52,7
@@
class ZenRules extends ChessRules
i += step[0];
j += step[1];
}
i += step[0];
j += step[1];
}
- if (V.OnBoard(i,j) && this.getColor(i,j) ==
this.g
etOppCol(color)
+ if (V.OnBoard(i,j) && this.getColor(i,j) ==
V.G
etOppCol(color)
&& this.getPiece(i,j) == asA)
{
// eat!
&& this.getPiece(i,j) == asA)
{
// eat!
@@
-97,7
+97,7
@@
class ZenRules extends ChessRules
const firstRank = (color == 'w' ? sizeY-1 : 0);
const lastRank = (color == "w" ? 0 : sizeY-1);
const firstRank = (color == 'w' ? sizeY-1 : 0);
const lastRank = (color == "w" ? 0 : sizeY-1);
- if (x+shift
>= 0 && x+shift < sizeX && x+shift
!= lastRank)
+ if (x+shift != lastRank)
{
// Normal moves
if (this.board[x+shift][y] == V.EMPTY)
{
// Normal moves
if (this.board[x+shift][y] == V.EMPTY)
@@
-111,9
+111,8
@@
class ZenRules extends ChessRules
}
}
}
}
- if (x+shift == lastRank)
+ else //promotion
{
{
- // Promotion
let promotionPieces = [V.ROOK,V.KNIGHT,V.BISHOP,V.QUEEN];
promotionPieces.forEach(p => {
// Normal move
let promotionPieces = [V.ROOK,V.KNIGHT,V.BISHOP,V.QUEEN];
promotionPieces.forEach(p => {
// Normal move
@@
-226,5
+225,3
@@
class ZenRules extends ChessRules
}
}
}
}
}
}
-
-const VariantRules = ZenRules;