// Potential promotions:
const finalPieces = piece == V.PAWN && x + step[0] == lastRank
? [V.ROOK, V.KNIGHT, V.BISHOP, V.QUEEN]
// Potential promotions:
const finalPieces = piece == V.PAWN && x + step[0] == lastRank
? [V.ROOK, V.KNIGHT, V.BISHOP, V.QUEEN]
for (let p of finalPieces) {
moves.push(
this.getBasicMove([x,y], [x+step[0],y+step[1]], {
for (let p of finalPieces) {
moves.push(
this.getBasicMove([x,y], [x+step[0],y+step[1]], {