projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix Football
[vchess.git]
/
client
/
src
/
variants
/
Football.js
diff --git
a/client/src/variants/Football.js
b/client/src/variants/Football.js
index
18a3eca
..
eddad10
100644
(file)
--- a/
client/src/variants/Football.js
+++ b/
client/src/variants/Football.js
@@
-266,6
+266,7
@@
export class FootballRules extends ChessRules {
const c = this.turn;
let moves = [];
let kicks = {};
const c = this.turn;
let moves = [];
let kicks = {};
+ let adjacentPieces = false;
for (let s of steps) {
const [i, j] = [x + s[0], y + s[1]];
if (
for (let s of steps) {
const [i, j] = [x + s[0], y + s[1]];
if (
@@
-281,15
+282,19
@@
export class FootballRules extends ChessRules {
kicks[key] = true;
}
});
kicks[key] = true;
}
});
+ if (!adjacentPieces) adjacentPieces = true;
}
}
}
}
- if (
Object.keys(kicks).length > 0
) {
- // A
nd, always add the "end" move. For computer, keep only one
+ if (
adjacentPieces
) {
+ // A
dd the "end" move (even if no valid kicks)
outerLoop: for (let i=0; i < V.size.x; i++) {
for (let j=0; j < V.size.y; j++) {
if (this.board[i][j] != V.EMPTY && this.getColor(i, j) == c) {
outerLoop: for (let i=0; i < V.size.x; i++) {
for (let j=0; j < V.size.y; j++) {
if (this.board[i][j] != V.EMPTY && this.getColor(i, j) == c) {
- moves.push(super.getBasicMove([x, y], [i, j]));
- if (computer) break outerLoop;
+ moves.push({
+ appear: [], vanish: [],
+ start: { x: x, y: y }, end: { x: i, y: j }
+ });
+ if (computer) break outerLoop; //no choice for computer
}
}
}
}
}
}