summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2002-04-09 10:06:44 +0000
committerJohn Wiegley <johnw@newartisans.com>2002-04-09 10:06:44 +0000
commit91a1e2d52130c9e6f90497614633c7f4e1efb5b3 (patch)
tree38931f48bf619024784db4a1cdfa56eb630af26f
parent4a5de0c46970e59b1cb890cdb6cdfdcae47b34a8 (diff)
*** no comment ***
-rw-r--r--TODO6
-rw-r--r--chess-engine.el29
-rw-r--r--chess-game.el2
-rw-r--r--chess-irc.el4
4 files changed, 22 insertions, 19 deletions
diff --git a/TODO b/TODO
index 32c2d30..7362972 100644
--- a/TODO
+++ b/TODO
@@ -7,6 +7,12 @@
analysis/highlight tools
scid interaction
+- Make use of the my-color data in chess-game.el to ensure that I only
+ do what I should be doing
+
+- After somebody sends me "name", I need a responding event to tell
+ them my name
+
- Allow the user to request a move retraction (ala takeback)
- In edit mode, mouse-2 and mouse-3 should provide a drop-down list of
diff --git a/chess-engine.el b/chess-engine.el
index fd448fe..23622ed 100644
--- a/chess-engine.el
+++ b/chess-engine.el
@@ -62,29 +62,26 @@
(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
- (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))))
- (if ply
- (chess-engine-do-move ply)
- (message "Received invalid move from engine: %s" (car args)))))
+ (if (null ply)
+ (message "Received invalid move from engine: %s" (car args))
+ ;; if the game index is still 0, then our opponent is white,
+ ;; and we need to pass over the move
+ (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))))
+ (chess-engine-do-move ply))))
((eq event 'pass)
(message "Your opponent has passed the first move to you"))
((eq event 'connect)
- (message "Your opponent, %s, is now ready to play" (car args))
- (chess-engine-send nil (format "name %s\n" (user-full-name))))
+ (message "Your opponent, %s, is now ready to play" (car args)))
((eq event 'quit)
(message "Your opponent has quit playing"))
diff --git a/chess-game.el b/chess-game.el
index 6e22ff8..500df8d 100644
--- a/chess-game.el
+++ b/chess-game.el
@@ -88,7 +88,7 @@
(defun chess-game-set-data (game key value)
(let ((alist (chess-game-data-alist game)))
(if (null alist)
- (setcar (nthcdr 1 game) (list (cons key value)))
+ (setcar (nthcdr 2 game) (list (cons key value)))
(push (cons key value) alist))
(chess-game-run-hooks game 'set-data key)))
diff --git a/chess-irc.el b/chess-irc.el
index d1fe256..78e49a4 100644
--- a/chess-irc.el
+++ b/chess-irc.el
@@ -65,13 +65,13 @@
(set-process-filter proc 'chess-irc-filter)
(set-process-buffer proc (current-buffer))
(set-marker (process-mark proc) (point))
- (message "Now waiting for 'name USER' via /msg; or `M-x chess-irc-engage'")))
+ (message "Now waiting for 'name USER' via /msg, or `M-x chess-irc-engage'")))
(setq chess-irc-process proc))
nil)
((eq event 'shutdown)
(ignore-errors
- (chess-engine-send nil "game over"))
+ (chess-engine-send nil "quit"))
(ignore-errors
(process-send-string chess-irc-process "QUIT :Goodbye\n"))
(ignore-errors