+ // and one of them at least should be a pawn.
+ const dirs = [ [1,0],[0,1],[1,1],[-1,1] ];
+ const [sizeX,sizeY] = VariantRules.size;
+ for (let dir of dirs)
+ {
+ const [i1,j1] = [x-dir[0],y-dir[1]]; //"before"
+ const [i2,j2] = [x+dir[0],y+dir[1]]; //"after"
+ if (i1>=0 && i1<sizeX && i2>=0 && i2<sizeX
+ && j1>=0 && j1<sizeY && j2>=0 && j2<sizeY
+ && this.board[i1][j1]!=VariantRules.EMPTY
+ && this.board[i2][j2]!=VariantRules.EMPTY
+ && colors.includes(this.getColor(i1,j1))
+ && colors.includes(this.getColor(i2,j2))
+ && [this.getPiece(i1,j1),this.getPiece(i2,j2)].includes(VariantRules.PAWN))
+ {
+ return true;
+ }
+ }