+
+ isAttackedByPawn([x,y], colors)
+ {
+ for (let c of colors)
+ {
+ let pawnShift = (c=="w" ? 1 : -1);
+ if (x+pawnShift>=0 && x+pawnShift<V.size.x)
+ {
+ if (this.getPiece(x+pawnShift,y)==V.PAWN
+ && this.getColor(x+pawnShift,y)==c)
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ getNotation(move)
+ {
+ const piece = this.getPiece(move.start.x, move.start.y);
+ if (piece == V.PAWN)
+ {
+ // Pawn move
+ let notation = "";
+ if (move.vanish.length == 2) //capture
+ notation = finalSquare;
+ else
+ {
+ // No capture
+ const startColumn = V.CoordToColumn(move.start.y);
+ notation = startColumn + "x" + finalSquare;
+ }
+ if (move.appear[0].p != V.PAWN) //promotion
+ notation += "=" + move.appear[0].p.toUpperCase();
+ return notation;
+ }
+ return super.getNotation(move); //all other pieces are orthodox
+ }