projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
First draft of S-chess variant + a few fixes
[vchess.git]
/
client
/
src
/
base_rules.js
diff --git
a/client/src/base_rules.js
b/client/src/base_rules.js
index
f957400
..
52ec2c5
100644
(file)
--- a/
client/src/base_rules.js
+++ b/
client/src/base_rules.js
@@
-191,9
+191,9
@@
export const ChessRules = class ChessRules {
return V.CoordToColumn(coords.y) + (V.size.x - coords.x);
}
return V.CoordToColumn(coords.y) + (V.size.x - coords.x);
}
- // Path to pieces
+ // Path to pieces
(standard ones in pieces/ folder)
getPpath(b) {
getPpath(b) {
- return b;
//usual pieces in pieces/ folder
+ return b;
}
// Path to promotion pieces (usually the same)
}
// Path to promotion pieces (usually the same)
@@
-679,6
+679,7
@@
export const ChessRules = class ChessRules {
enpassantMove.vanish.push({
x: x,
y: epSquare.y,
enpassantMove.vanish.push({
x: x,
y: epSquare.y,
+ // Captured piece is usually a pawn, but next line seems harmless
p: this.getPiece(x, epSquare.y),
c: this.getColor(x, epSquare.y)
});
p: this.getPiece(x, epSquare.y),
c: this.getColor(x, epSquare.y)
});
@@
-1100,7
+1101,9
@@
export const ChessRules = class ChessRules {
) {
const flagIdx = (move.start.y == this.castleFlags[c][0] ? 0 : 1);
this.castleFlags[c][flagIdx] = V.size.y;
) {
const flagIdx = (move.start.y == this.castleFlags[c][0] ? 0 : 1);
this.castleFlags[c][flagIdx] = V.size.y;
- } else if (
+ }
+ // NOTE: not "else if" because a rook could take an opposing rook
+ if (
move.end.x == oppFirstRank && //we took opponent rook?
this.castleFlags[oppCol].includes(move.end.y)
) {
move.end.x == oppFirstRank && //we took opponent rook?
this.castleFlags[oppCol].includes(move.end.y)
) {