summaryrefslogtreecommitdiff
path: root/chess-engine.el
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2002-04-09 09:55:46 +0000
committerJohn Wiegley <johnw@newartisans.com>2002-04-09 09:55:46 +0000
commit4a5de0c46970e59b1cb890cdb6cdfdcae47b34a8 (patch)
treeca142c5950172456afc075c157fde526473f4efc /chess-engine.el
parent456d3cdaf4559b55f424fac8f5742473ac79224b (diff)
*** no comment ***
Diffstat (limited to 'chess-engine.el')
-rw-r--r--chess-engine.el12
1 files changed, 9 insertions, 3 deletions
diff --git a/chess-engine.el b/chess-engine.el
index 6c5df34..fd448fe 100644
--- a/chess-engine.el
+++ b/chess-engine.el
@@ -62,10 +62,16 @@
(let ((chess-engine-handling-event t))
(cond
((eq event 'move)
+
;; if the game index is still 0, then our opponent is white, and
;; we need to pass over the move
- (if (= (chess-game-index (chess-engine-game nil)) 0)
- (chess-game-run-hooks (chess-engine-game nil) 'pass))
+ (let ((game (chess-engine-game nil)))
+ (when (and game (chess-game-get-data game 'my-color)
+ (= (chess-game-index game) 0))
+ (chess-game-run-hooks game 'pass)
+ ;; if no one else flipped my-color, we'll do it
+ (if (chess-game-get-data game 'my-color)
+ (chess-game-set-data game 'my-color nil))))
(let ((ply (chess-algebraic-to-ply (chess-engine-position nil)
(car args))))
@@ -78,7 +84,7 @@
((eq event 'connect)
(message "Your opponent, %s, is now ready to play" (car args))
- (chess-engine-send nil "name %s\n" (user-full-name)))
+ (chess-engine-send nil (format "name %s\n" (user-full-name))))
((eq event 'quit)
(message "Your opponent has quit playing"))