return Object.assign(
{},
ChessRules.PawnSpecs,
- { promotions: ChessRules.PawnSpecs.promotions.concat([V.CHAMPION]) }
+ { promotions: ChessRules.PawnSpecs.promotions.concat([V.PHOENIX]) }
);
}
return false;
}
- static get CHAMPION() {
- return 'c';
+ static get PHOENIX() {
+ return 'h';
}
static get BALL() {
'b': 'd',
'q': 't',
'k': 'l',
- 'c': 'h'
+ 'h': 'i'
};
}
'd': 'b',
't': 'q',
'l': 'k',
- 'h': 'c'
+ 'i': 'h'
};
}
static get PIECES() {
return ChessRules.PIECES
- .concat([V.CHAMPION])
+ .concat([V.PHOENIX])
.concat(Object.keys(V.HAS_BALL_DECODE))
.concat(['a']);
}
let prefix = "";
const withPrefix =
Object.keys(V.HAS_BALL_DECODE)
- .concat([V.CHAMPION])
+ .concat([V.PHOENIX])
.concat(['a']);
if (withPrefix.includes(b[1])) prefix = "Ball/";
return prefix + b;
static GenRandInitFen(randomness) {
if (randomness == 0)
- return "rnbcqcnbr/ppppppppp/9/9/4a4/9/9/PPPPPPPPP/RNBCQCNBR w 0 -";
+ return "hbnrqrnhb/ppppppppp/9/9/4a4/9/9/PPPPPPPPP/HBNRQRNHB w 0 -";
let pieces = { w: new Array(9), b: new Array(9) };
for (let c of ["w", "b"]) {
break;
}
- // Get random squares for every piece, totally freely
+ // Get random squares for every piece, with bishops and phoenixes
+ // on different colors:
let positions = shuffle(ArrayFun.range(9));
- const composition = ['b', 'b', 'r', 'r', 'n', 'n', 'c', 'c', 'q'];
- const rem2 = positions[0] % 2;
+ const composition = ['b', 'b', 'h', 'h', 'n', 'n', 'r', 'r', 'q'];
+ let rem2 = positions[0] % 2;
if (rem2 == positions[1] % 2) {
// Fix bishops (on different colors)
- for (let i=2; i<9; i++) {
+ for (let i=4; i<9; i++) {
if (positions[i] % 2 != rem2)
[positions[1], positions[i]] = [positions[i], positions[1]];
}
}
+ rem2 = positions[2] % 2;
+ if (rem2 == positions[3] % 2) {
+ // Fix phoenixes too:
+ for (let i=4; i<9; i++) {
+ if (positions[i] % 2 != rem2)
+ [positions[3], positions[i]] = [positions[i], positions[3]];
+ }
+ }
for (let i = 0; i < 9; i++) pieces[c][positions[i]] = composition[i];
}
return (
return Object.assign(
{},
ChessRules.steps,
- // Add champion moves
+ // Add phoenix moves
{
- c: [
+ h: [
[-2, -2],
- [-2, 0],
[-2, 2],
- [0, -2],
- [0, 2],
[2, -2],
- [2, 0],
[2, 2],
[-1, 0],
[1, 0],
// So base implementation is fine.
getPotentialMovesFrom([x, y]) {
- if (this.getPiece(x, y) == V.CHAMPION)
- return this.getPotentialChampionMoves([x, y]);
+ if (this.getPiece(x, y) == V.PHOENIX)
+ return this.getPotentialPhoenixMoves([x, y]);
return super.getPotentialMovesFrom([x, y]);
}
return moves;
}
- getPotentialChampionMoves(sq) {
- return this.getSlideNJumpMoves(sq, V.steps[V.CHAMPION], "oneStep");
+ getPotentialPhoenixMoves(sq) {
+ return this.getSlideNJumpMoves(sq, V.steps[V.PHOENIX], "oneStep");
}
filterValid(moves) {
return {
p: 1,
r: 3,
- n: 4,
+ n: 3,
b: 2,
q: 5,
- c: 4,
+ h: 3,
a: 0 //ball: neutral
};
}