+ pieces(color, x, y) {
+ let baseRes = super.pieces(color, x, y);
+ if (
+ this.getPiece(x, y) == 'p' &&
+ this.stage == 2 &&
+ this.getColor(x, y) == 'c'
+ ) {
+ // Checkered pawns on stage 2 are bidirectional
+ const initRank = ((color == 'w' && x >= 6) || (color == 'b' && x <= 1));
+ baseRes['p'] = {
+ "class": "pawn",
+ moves: [
+ {
+ steps: [[1, 0], [-1, 0]],
+ range: (initRank ? 2 : 1)
+ }
+ ],
+ attack: [
+ {
+ steps: [[1, 1], [1, -1], [-1, 1], [-1, -1]],
+ range: 1
+ }
+ ]
+ };
+ }
+ const checkered = {
+ 's': {"class": "checkered-pawn", moveas: 'p'},
+ 'u': {"class": "checkered-rook", moveas: 'r'},
+ 'o': {"class": "checkered-knight", moveas: 'n'},
+ 'c': {"class": "checkered-bishop", moveas: 'b'},
+ 't': {"class": "checkered-queen", moveas: 'q'}
+ };
+ return Object.assign(baseRes, checkered);
+ }