+
+ getNotation(move) {
+ // Translate initial square (because pieces may fly unusually!)
+ const initialSquare = V.CoordsToSquare(move.start);
+
+ // Translate final square
+ const finalSquare = V.CoordsToSquare(move.end);
+
+ let notation = "";
+ const piece = this.getPiece(move.start.x, move.start.y);
+ if (piece == V.PAWN) {
+ // pawn move (TODO: enPassant indication)
+ if (move.vanish.length == 2) {
+ // capture
+ notation = initialSquare + "x" + finalSquare;
+ }
+ else notation = finalSquare;
+ if (piece != move.appear[0].p)
+ //promotion
+ notation += "=" + move.appear[0].p.toUpperCase();
+ }
+ else {
+ // Piece movement
+ notation = piece.toUpperCase();
+ if (move.vanish.length > 1) notation += initialSquare + "x";
+ notation += finalSquare;
+ }
+ return notation;
+ }
+