- get hasEnpassant() {
- return false;
- }
-
- canTake() {
- return false;
- }
-
- // Find potential captures from a square
- // follow steps from x,y until something is met.
- findAttacks([x, y]) {
- const [color, piece] = [this.getColor(x, y), this.getPiece(x, y)];
- const oppCol = C.GetOppCol(color);
- let squares = {};
- const specs = this.pieces(color, x, y)[piece];
- const attacks = specs.attack || specs.moves;
- for (let a of attacks) {
- outerLoop: for (let step of a.steps) {
- let [i, j] = [x + step[0], this.computeY(y + step[1])];
- let nbSteps = 1;
- while (this.onBoard(i, j) && this.board[i][j] == "") {
- if (a.range <= nbSteps++) continue outerLoop;
- i += step[0];
- j = this.computeY(j + step[1]);
- }
- if (this.onBoard(i, j) && this.getColor(i, j) == oppCol)
- squares[C.CoordsToSquare({x: i, y: j})] = true;
- }
- }
- return Object.keys(squares);
+ pieces(color, x, y) {
+ if (!this.options["cleopatra"])
+ return super.pieces(color, x, y);
+ const allSpecs = super.pieces(color, x, y);
+ return Object.assign({},
+ allSpecs,
+ {'q': Object.assign({}, allSpecs['q'], {"class": "cleopatra"})}
+ );