projects
/
xogo.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Bario: final fix
[xogo.git]
/
variants
/
Ambiguous
/
class.js
diff --git
a/variants/Ambiguous/class.js
b/variants/Ambiguous/class.js
index
6a001a6
..
4311c4d
100644
(file)
--- a/
variants/Ambiguous/class.js
+++ b/
variants/Ambiguous/class.js
@@
-22,10
+22,10
@@
export default class AmbiguousRules extends ChessRules {
this.subTurn = 1;
}
this.subTurn = 1;
}
- genRandInit
Fen(seed
) {
+ genRandInit
BaseFen(
) {
const options = Object.assign({mode: "suicide"}, this.options);
const gr = new GiveawayRules({options: options, genFenOnly: true});
const options = Object.assign({mode: "suicide"}, this.options);
const gr = new GiveawayRules({options: options, genFenOnly: true});
- return gr.genRandInit
Fen(seed
);
+ return gr.genRandInit
BaseFen(
);
}
canStepOver(x, y) {
}
canStepOver(x, y) {
@@
-55,13
+55,11
@@
export default class AmbiguousRules extends ChessRules {
return true;
})
.map(m => {
return true;
})
.map(m => {
- if (m.vanish.length == 1) {
- m.appear[0].c = 'a'; //a-color
+ if (m.vanish.length == 1)
m.appear[0].p = V.GOAL;
m.appear[0].p = V.GOAL;
- }
else {
m.appear[0].p = V.TARGET_CODE[m.vanish[1].p];
else {
m.appear[0].p = V.TARGET_CODE[m.vanish[1].p];
- m.appear[0].c =
oppCol
;
+ m.appear[0].c =
m.vanish[1].c
;
}
m.vanish.shift();
return m;
}
m.vanish.shift();
return m;
@@
-69,7
+67,7
@@
export default class AmbiguousRules extends ChessRules {
);
}
// At subTurn == 1, play a targeted move for the opponent.
);
}
// At subTurn == 1, play a targeted move for the opponent.
- // Search for target
(we could also have it in a stack...)
+ // Search for target
:
let target = {x: -1, y: -1};
outerLoop: for (let i = 0; i < this.size.x; i++) {
for (let j = 0; j < this.size.y; j++) {
let target = {x: -1, y: -1};
outerLoop: for (let i = 0; i < this.size.x; i++) {
for (let j = 0; j < this.size.y; j++) {
@@
-133,8
+131,8
@@
export default class AmbiguousRules extends ChessRules {
't': {"class": "target-queen", moves: []},
'l': {"class": "target-king", moves: []}
};
't': {"class": "target-queen", moves: []},
'l': {"class": "target-king", moves: []}
};
- return Object.assign(
-
{ 'g': {"class": "target"} },
targets, super.pieces(color, x, y));
+ return Object.assign(
{ 'g': {"class": "target", moves: []} },
+ targets, super.pieces(color, x, y));
}
atLeastOneMove() {
}
atLeastOneMove() {
@@
-146,22
+144,23
@@
export default class AmbiguousRules extends ChessRules {
return moves;
}
return moves;
}
- isKing(symbol) {
- return ['k', 'l'].includes(symbol);
+ isKing(x, y, p) {
+ if (!p)
+ p = this.getPiece(x, y);
+ return ['k', 'l'].includes(p);
}
getCurrentScore() {
// This function is only called at subTurn 1
const color = C.GetOppCol(this.turn);
}
getCurrentScore() {
// This function is only called at subTurn 1
const color = C.GetOppCol(this.turn);
- const kingPos = this.searchKingPos(color);
- if (kingPos[0] < 0)
+ if (this.searchKingPos(color).length == 0)
return (color == 'w' ? "0-1" : "1-0");
return "*";
}
postPlay(move) {
const color = this.turn;
return (color == 'w' ? "0-1" : "1-0");
return "*";
}
postPlay(move) {
const color = this.turn;
- if (this.subTurn == 2 || this.searchKingPos(color)
[0] <
0) {
+ if (this.subTurn == 2 || this.searchKingPos(color)
.length ==
0) {
this.turn = C.GetOppCol(color);
this.movesCount++;
}
this.turn = C.GetOppCol(color);
this.movesCount++;
}