Skip to content

Latest commit

 

History

History
36 lines (24 loc) · 782 Bytes

chess.ts.chess.gameover.md

File metadata and controls

36 lines (24 loc) · 782 Bytes

Home > chess.ts > Chess > gameOver

Chess.gameOver() method

Returns true if the game has ended via checkmate, stalemate, draw, threefold repetition, or insufficient material. Otherwise, returns false.

Signature:

gameOver(): boolean;

Returns:

boolean

Example

const chess = new Chess()
chess.gameOver()
// -> false

// stalemate
chess.load('4k3/4P3/4K3/8/8/8/8/8 b - - 0 78')
chess.gameOver()
// -> true

// checkmate
chess.load('rnb1kbnr/pppp1ppp/8/4p3/5PPq/8/PPPPP2P/RNBQKBNR w KQkq - 1 3')
chess.gameOver()
// -> true