Skip to content

Commit

Permalink
add removePiece method
Browse files Browse the repository at this point in the history
  • Loading branch information
qwerty084 committed Mar 2, 2024
1 parent 7e14d1f commit 4ef7ec4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/classes/BoardApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,16 @@ export class BoardApi {
}
}

/**
* Removes a piece from the board.
* @param square - The square where the piece is located.
*/
removePiece(square: Square): void {
const pieces = this.board.state.pieces;
pieces.delete(square);
this.game.remove(square);
}

/**
* removes all pieces from the board
*/
Expand Down

0 comments on commit 4ef7ec4

Please sign in to comment.