+ static get PawnSpecs() {
+ return SuicideRules.PawnSpecs;
+ }
+
+ static get HasCastle() {
+ return false;
+ }
+
+ static get CorrConfirm() {
+ // Because of bonus effects
+ return false;
+ }
+
+ static get CanAnalyze() {
+ return false;
+ }
+
+ hoverHighlight(x, y) {
+ if (this.subTurn == 1) return false;
+ const L = this.firstMove.length;
+ const fm = this.firstMove[L-1];
+ if (fm.end.effect != 0) return false;
+ const deltaX = Math.abs(fm.end.x - x);
+ const deltaY = Math.abs(fm.end.y - y);
+ return (
+ (deltaX == 0 && deltaY == 0) ||
+ (
+ this.board[x][y] == V.EMPTY &&
+ (
+ (fm.vanish[0].p == V.ROOK && deltaX == 1 && deltaY == 1) ||
+ (fm.vanish[0].p == V.BISHOP && deltaX + deltaY == 1)
+ )
+ )
+ );
+ }
+
+ static get IMMOBILIZE_CODE() {
+ return {
+ 'p': 's',
+ 'r': 'u',
+ 'n': 'o',
+ 'b': 'c',
+ 'q': 't',
+ 'k': 'l'
+ };
+ }
+
+ static get IMMOBILIZE_DECODE() {
+ return {
+ 's': 'p',
+ 'u': 'r',
+ 'o': 'n',
+ 'c': 'b',
+ 't': 'q',
+ 'l': 'k'
+ };
+ }
+
+ static get INVISIBLE_QUEEN() {
+ return 'i';
+ }
+
+ // Fictive color 'a', bomb banana mushroom egg
+ static get BOMB() {
+ // Doesn't collide with bishop because color 'a'
+ return 'b';
+ }
+ static get BANANA() {
+ return 'n';
+ }
+ static get EGG() {
+ return 'e';
+ }
+ static get MUSHROOM() {
+ return 'm';
+ }
+
+ static get PIECES() {
+ return (
+ ChessRules.PIECES.concat(
+ Object.keys(V.IMMOBILIZE_DECODE)).concat(
+ [V.BANANA, V.BOMB, V.EGG, V.MUSHROOM, V.INVISIBLE_QUEEN])
+ );
+ }
+
+ getPpath(b) {
+ let prefix = "";
+ if (
+ b[0] == 'a' ||
+ b[1] == V.INVISIBLE_QUEEN ||
+ Object.keys(V.IMMOBILIZE_DECODE).includes(b[1])
+ ) {
+ prefix = "Chakart/";
+ }
+ return prefix + b;
+ }
+
+ static ParseFen(fen) {
+ const fenParts = fen.split(" ");
+ return Object.assign(
+ ChessRules.ParseFen(fen),
+ { captured: fenParts[5] }
+ );
+ }
+
+ // King can be l or L (immobilized) --> similar to Alice variant
+ static IsGoodPosition(position) {
+ if (position.length == 0) return false;
+ const rows = position.split("/");
+ if (rows.length != V.size.x) return false;
+ let kings = { "k": 0, "K": 0, 'l': 0, 'L': 0 };
+ for (let row of rows) {
+ let sumElts = 0;
+ for (let i = 0; i < row.length; i++) {
+ if (['K','k','L','l'].includes(row[i])) kings[row[i]]++;
+ if (V.PIECES.includes(row[i].toLowerCase())) sumElts++;
+ else {
+ const num = parseInt(row[i]);
+ if (isNaN(num)) return false;
+ sumElts += num;
+ }
+ }
+ if (sumElts != V.size.y) return false;
+ }
+ if (kings['k'] + kings['l'] != 1 || kings['K'] + kings['L'] != 1)
+ return false;
+ return true;
+ }
+
+ static IsGoodFlags(flags) {
+ // 4 for Peach + Mario w, b
+ return !!flags.match(/^[01]{4,4}$/);
+ }