projects
/
xogo.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0026d63
)
update
main
author
Benjamin Auder
<benjamin.auder@somewhere>
Tue, 9 Jun 2026 09:21:11 +0000
(11:21 +0200)
committer
Benjamin Auder
<benjamin.auder@somewhere>
Tue, 9 Jun 2026 09:21:11 +0000
(11:21 +0200)
variants/Emergo/class.js
patch
|
blob
|
blame
|
history
diff --git
a/variants/Emergo/class.js
b/variants/Emergo/class.js
index
f02135f
..
6cbebdf
100644
(file)
--- a/
variants/Emergo/class.js
+++ b/
variants/Emergo/class.js
@@
-467,28
+467,25
@@
export default class EmergoRules extends ChessRules {
return mv;
}
return mv;
}
-
- // TODO: finish from here
-
-
getDropMovesFrom([c, p]) {
const color = c;
getDropMovesFrom([c, p]) {
const color = c;
- if (!this.reserve[color] || this.atLeastOneCapture(color))
+ const rp = (color == 'w' ? ["A@", "a@"] : ["a@", "A@"]);
+ if (this.reserve[color][rp[0]] == 0 || this.atLeastOneCapture(color))
return [];
let moves = [];
const oppCol = C.GetOppTurn(color);
const shadowPiece =
return [];
let moves = [];
const oppCol = C.GetOppTurn(color);
const shadowPiece =
- !this.reserve[oppCol]
- ? this.reserve[color][
'p'
] - 1
+ this.reserve[oppCol][rp[1]] == 0
+ ? this.reserve[color][
rp[0]
] - 1
: 0;
: 0;
- const appear
Color
= String.fromCharCode(
+ const appear
Num
= String.fromCharCode(
(color == 'w' ? 'A' : 'a').charCodeAt(0) + shadowPiece);
const addMove = ([i, j]) => {
moves.push(
new Move({
(color == 'w' ? 'A' : 'a').charCodeAt(0) + shadowPiece);
const addMove = ([i, j]) => {
moves.push(
new Move({
- appear: [ new PiPo({ x: i, y: j, c:
appearColor, p:
'@' }) ],
+ appear: [ new PiPo({ x: i, y: j, c:
color, p: appearNum +
'@' }) ],
vanish: [],
vanish: [],
- start: { x:
this.size.x + (color == 'w' ? 0 : 1), y: 0
}
+ start: { x:
c, y: p
}
})
);
};
})
);
};
@@
-504,7
+501,7
@@
export default class EmergoRules extends ChessRules {
addMove([i, j]);
else {
let canAddMove = true;
addMove([i, j]);
else {
let canAddMove = true;
- for (let s of
super.pieceDef('b').both
[0].steps) {
+ for (let s of
this.pieceDef().moves
[0].steps) {
if (
this.onBoard(i + s[0], j + s[1]) &&
this.onBoard(i - s[0], j - s[1]) &&
if (
this.onBoard(i + s[0], j + s[1]) &&
this.onBoard(i - s[0], j - s[1]) &&
@@
-525,6
+522,10
@@
export default class EmergoRules extends ChessRules {
return moves;
}
return moves;
}
+
+ // TODO: finish from here
+
+
getPossibleMovesFrom([x, y], longestCaptures) {
if (typeof x === "string") {
if (longestCaptures.length == 0)
getPossibleMovesFrom([x, y], longestCaptures) {
if (typeof x === "string") {
if (longestCaptures.length == 0)