projects
/
xogo.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Cleaner fen generation + first draft of Apocalypse + a few fixes
[xogo.git]
/
variants
/
Suction
/
class.js
diff --git
a/variants/Suction/class.js
b/variants/Suction/class.js
index
a66855d
..
889a37f
100644
(file)
--- a/
variants/Suction/class.js
+++ b/
variants/Suction/class.js
@@
-41,22
+41,19
@@
export default class SuctionRules extends ChessRules {
}
}
}
}
- 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});
- const baseFen = gr.genRandInitFen(seed);
- // Add empty cmove:
- const fenParts = baseFen.split(" ");
- let others = JSON.parse(fenParts[3]);
- others["cmove"] = "-";
- return fenParts.slice(0, 3).join(" ") + " " + JSON.stringify(others);
+ return gr.genRandInitBaseFen();
}
}
- getFen() {
- const cmoveFen = !this.cmove
+ getPartFen(o) {
+ let parts = super.getPartFen(o);
+ const cmoveFen = o.init || !this.cmove
? "-"
: C.CoordsToSquare(this.cmove.start) + C.CoordsToSquare(this.cmove.end);
? "-"
: C.CoordsToSquare(this.cmove.start) + C.CoordsToSquare(this.cmove.end);
- return super.getFen().slice(0, -1) + ',"cmove":"' + cmoveFen + '"}';
+ parts["cmove"] = cmoveFen;
+ return parts;
}
getBasicMove([sx, sy], [ex, ey]) {
}
getBasicMove([sx, sy], [ex, ey]) {
@@
-107,8
+104,8
@@
export default class SuctionRules extends ChessRules {
getCurrentScore() {
const color = this.turn;
const kingPos = super.searchKingPos(color);
getCurrentScore() {
const color = this.turn;
const kingPos = super.searchKingPos(color);
- if (color == "w" && kingPos[0] == 0) return "0-1";
- if (color == "b" && kingPos[0] == this.size.x - 1) return "1-0";
+ if (color == "w" && kingPos[0]
[0]
== 0) return "0-1";
+ if (color == "b" && kingPos[0]
[0]
== this.size.x - 1) return "1-0";
// King is not on the opposite edge: game not over
return "*";
}
// King is not on the opposite edge: game not over
return "*";
}