Skip to content

Game

Game

done(self)

Indicator if the game is finished Used to end game loops

Can be included: - board.is_stalemate() - board.is_insufficient_material() - board.is_game_over()

Returns:

Type Description
bool

If the game is finished

Source code in beth\game.py
def done(self):
    """Indicator if the game is finished
    Used to end game loops

    Can be included:
    - board.is_stalemate()
    - board.is_insufficient_material()
    - board.is_game_over()

    Returns:
        bool: If the game is finished
    """
    if self.board.is_checkmate():
        return True
    elif self.board.is_stalemate():
        return True
    elif self.board.is_fivefold_repetition():
        return True
    elif self.board.is_seventyfive_moves():
        return True
    elif self.board.is_insufficient_material():
        return True
    else:
        return False