projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix captures and some moves for Grand & Wildebeest
[vchess.git]
/
public
/
javascripts
/
variants
/
Grand.js
diff --git
a/public/javascripts/variants/Grand.js
b/public/javascripts/variants/Grand.js
index
faf7f63
..
8cdf6d7
100644
(file)
--- a/
public/javascripts/variants/Grand.js
+++ b/
public/javascripts/variants/Grand.js
@@
-76,7
+76,7
@@
class GrandRules extends ChessRules
{
// Two squares jump
moves.push(this.getBasicMove([x,y], [x+2*shift,y]));
{
// Two squares jump
moves.push(this.getBasicMove([x,y], [x+2*shift,y]));
- if (x == startRanks[0] && this.board[x+
2
*shift][y] == V.EMPTY)
+ if (x == startRanks[0] && this.board[x+
3
*shift][y] == V.EMPTY)
{
// 3-squares jump
moves.push(this.getBasicMove([x,y], [x+3*shift,y]));
{
// 3-squares jump
moves.push(this.getBasicMove([x,y], [x+3*shift,y]));
@@
-93,7
+93,7
@@
class GrandRules extends ChessRules
if (lastRanks.includes(x+shift))
{
// Promotion
if (lastRanks.includes(x+shift))
{
// Promotion
- let promotionPieces = [V.ROOK,V.KNIGHT,V.BISHOP,V.QUEEN];
+ let promotionPieces = [V.ROOK,V.KNIGHT,V.BISHOP,V.QUEEN
,V.MARSHALL,V.CARDINAL
];
promotionPieces.forEach(p => {
if (!this.captures[color][p] || this.captures[color][p]==0)
return;
promotionPieces.forEach(p => {
if (!this.captures[color][p] || this.captures[color][p]==0)
return;
@@
-134,6
+134,8
@@
class GrandRules extends ChessRules
return moves;
}
return moves;
}
+ // TODO: different castle?
+
getPotentialMarshallMoves(sq)
{
const V = VariantRules;
getPotentialMarshallMoves(sq)
{
const V = VariantRules;
@@
-189,7
+191,6
@@
class GrandRules extends ChessRules
if (move.vanish.length==2 && move.appear.length==1
&& move.vanish[1].p != VariantRules.PAWN)
{
if (move.vanish.length==2 && move.appear.length==1
&& move.vanish[1].p != VariantRules.PAWN)
{
- // Capture: update this.captures
this.captures[move.vanish[1].c][move.vanish[1].p] =
Math.max(0, this.captures[move.vanish[1].c][move.vanish[1].p]-1);
}
this.captures[move.vanish[1].c][move.vanish[1].p] =
Math.max(0, this.captures[move.vanish[1].c][move.vanish[1].p]-1);
}
@@
-202,6
+203,8
@@
class GrandRules extends ChessRules
);
}
);
}
+ static get SEARCH_DEPTH() { return 2; }
+
// TODO: this function could be generalized and shared better
static GenRandInitFen()
{
// TODO: this function could be generalized and shared better
static GenRandInitFen()
{