diff options
| author | John Wiegley <johnw@newartisans.com> | 2002-04-16 22:01:40 +0000 |
|---|---|---|
| committer | John Wiegley <johnw@newartisans.com> | 2002-04-16 22:01:40 +0000 |
| commit | 42d3479f1b83a50714f7cbc17925ac0201a55022 (patch) | |
| tree | 3c1128dcd4a8b06db6674a2475b8c2b3866425f2 /chess-game.el | |
| parent | 7c74ccf902b4a63128ee11db1e138a4eadfb7fd7 (diff) | |
Report checkmate in the modeline correctly.
Diffstat (limited to 'chess-game.el')
| -rw-r--r-- | chess-game.el | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/chess-game.el b/chess-game.el index 0e27fbd..f39a3e2 100644 --- a/chess-game.el +++ b/chess-game.el @@ -141,6 +141,16 @@ matches." "Return the position related to GAME's INDEX position." (chess-ply-pos (chess-game-ply game index))) +(defun chess-game-status (game &optional index) + "Return a symbol, such as :checkmate, :resign, etc. +This conveys the status of the game at the given index." + (or (car (chess-pos-status + (chess-game-pos chess-module-game index))) + (let ((final (chess-ply-final-p + (chess-game-ply chess-module-game index)))) + (and (memq final '(:resign :draw :perpetual :repetition)) + final)))) + (defsubst chess-game-index (game) "Return the GAME's current position index." (1- (length (chess-game-plies game)))) |
