return {
select: C.Options.select,
input: C.Options.input,
- styles: ["atomic", "capture", "crazyhouse", "cylinder", "dark", "zen"]
+ styles: C.Options.styles.filter(s => !["madrasi", "zen"].includes(s))
};
}
- getPotentialMovesFrom([x, y], color) {
- let moves = super.getPotentialMovesFrom([x, y], color);
- // Expand potential moves if attacking friendly pieces.
+ getStepSpec(color, x, y) {
+ let res = super.getStepSpec(color, x, y);
const piece = this.getPiece(x,y);
if (['p', 'k'].includes(piece))
- return moves;
+ return res;
+ // Now check if the piece at x, y attack some friendly one (enhancement)
let movements = {};
const steps = this.pieces()[piece].both[0].steps;
steps.forEach(s => {
i += s[0];
j += s[1];
}
- if (this.onBoard(i, j) && this.getColor(i, j) == this.turn) {
+ if (this.onBoard(i, j) && this.getColor(i, j) == color) {
const attacked = this.getPiece(i, j);
if (['r', 'b', 'n'].includes(attacked)) {
if (!movements[attacked])
}
});
Object.keys(movements).forEach(type => {
- if (
- (piece != 'q' && type != piece) ||
- (piece == 'q' && type == 'n')
- ) {
- Array.prototype.push.apply(moves,
- super.getPotentialMovesOf(type, [x, y]));
- }
+ if ((piece != 'q' && type != piece) || (piece == 'q' && type == 'n'))
+ res.both.push(this.pieces()[type].both[0]);
});
- return moves;
- }
-
- underAttack([x, y], oppCols) {
- if (super.underAttack([x, y], oppCols)
- return true;
- //TODO
+ return res;
}
};