summaryrefslogtreecommitdiff
path: root/chess-engine.el
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2002-04-28 16:09:14 +0000
committerJohn Wiegley <johnw@newartisans.com>2002-04-28 16:09:14 +0000
commit80ab4cec14452a641e741d372037dafda16ee871 (patch)
tree352324dc62ffbd3c9c651a7154a2e88338144641 /chess-engine.el
parent7248e5c89f6d53d3f2a4ecf511167af929241f76 (diff)
*** no comment ***
Diffstat (limited to 'chess-engine.el')
-rw-r--r--chess-engine.el17
1 files changed, 13 insertions, 4 deletions
diff --git a/chess-engine.el b/chess-engine.el
index 2beb35e..adce754 100644
--- a/chess-engine.el
+++ b/chess-engine.el
@@ -67,6 +67,7 @@
(opp-abort-ret . "Your opponent has retracted their offer to abort")
(opp-undo-ret . "Your opponent has retracted their request to undo %d moves")
(opp-illegal . "Your opponent states your last command was illegal")
+ (opp-call-flag . "Your flag fell, and your opponent has called time")
(failed-start . "Failed to start chess engine process")))
(defsubst chess-engine-convert-algebraic (move &optional trust-check)
@@ -167,7 +168,7 @@
(if (y-or-n-p (chess-string 'opp-draw))
(progn
(let ((chess-engine-handling-event t))
- (chess-game-end game :draw)
+ (chess-game-end game :drawn)
(chess-game-set-data game 'active nil))
(chess-engine-command nil 'accept))
(chess-engine-command nil 'decline))
@@ -177,6 +178,7 @@
(if (y-or-n-p (chess-string 'opp-abort))
(progn
(let ((chess-engine-handling-event t))
+ (chess-game-end game :aborted)
(chess-game-set-data game 'active nil))
(chess-engine-command nil 'accept))
(chess-engine-command nil 'decline))
@@ -206,11 +208,12 @@
(cond
((eq chess-engine-pending-offer 'draw)
(chess-message 'opp-draw-acc)
- (chess-game-end game :draw)
+ (chess-game-end game :drawn)
(chess-game-set-data game 'active nil))
((eq chess-engine-pending-offer 'abort)
(chess-message 'opp-abort-acc)
+ (chess-game-end game :aborted)
(chess-game-set-data game 'active nil))
((eq chess-engine-pending-offer 'undo)
@@ -260,8 +263,14 @@
(chess-game-undo game 1)))
((eq event 'call-flag)
- ;; jww (2002-04-21): what to do here?
- )
+ (let ((remaining
+ (chess-game-data game (if (chess-game-data game 'my-color)
+ 'white-remaining
+ 'black-remaining))))
+ (when (< remaining 0)
+ (chess-message 'opp-call-flag)
+ (chess-game-end game :flag-fell)
+ (chess-game-set-data game 'active nil))))
((eq event 'kibitz)
(let ((chess-engine-handling-event t))