diff options
| author | John Wiegley <johnw@newartisans.com> | 2002-04-12 20:21:58 +0000 |
|---|---|---|
| committer | John Wiegley <johnw@newartisans.com> | 2002-04-12 20:21:58 +0000 |
| commit | 758e770833d91fde40219e2f8bd9f8588b56706f (patch) | |
| tree | f922861a19c8e4b4136dfffccf3b9caf456d2da8 /chess-ics.el | |
| parent | 99d0a8277f275c1ffa48b948723a79df4d296e22 (diff) | |
*** no comment ***
Diffstat (limited to 'chess-ics.el')
| -rw-r--r-- | chess-ics.el | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/chess-ics.el b/chess-ics.el index 510fd69..4b06a41 100644 --- a/chess-ics.el +++ b/chess-ics.el @@ -131,13 +131,14 @@ who is black." (assert game) (if (and (chess-game-data game 'active) (> (chess-game-index game) 0)) - (if (and (cadr info) - (eq (chess-pos-side-to-move (car info)) - (chess-game-data game 'my-color))) - (chess-engine-do-move - (chess-algebraic-to-ply - (chess-ply-pos (car (last (chess-game-plies game)))) - (cadr info) t))) + (when (and (cadr info) + (eq (chess-pos-side-to-move (car info)) + (chess-game-data game 'my-color))) + (chess-engine-do-move + (chess-algebraic-to-ply + (chess-ply-pos (car (last (chess-game-plies game)))) + (cadr info) t)) + (assert (equal (car info) (chess-engine-position nil)))) (let ((chess-game-inhibit-events t) plies) (chess-game-set-data game 'my-color (string= (nth 2 info) chess-ics-handle)) @@ -199,18 +200,19 @@ who is black." (if chess-engine-last-pos (goto-char chess-engine-last-pos) (goto-char (point-min))) - (while (and (not (eobp)) - (/= (line-end-position) (point-max))) - (let ((triggers chess-ics-regexp-alist)) - (while triggers - ;; this could be accelerated by joining - ;; together the regexps - (if (and (looking-at (concat "[^\n\r]*" (caar triggers))) - (funcall (cdar triggers))) - (setq triggers nil) - (setq triggers (cdr triggers))))) - (forward-line)) - (setq chess-engine-last-pos (point)))) + (unwind-protect + (while (and (not (eobp)) + (/= (line-end-position) (point-max))) + (let ((triggers chess-ics-regexp-alist)) + (while triggers + ;; this could be accelerated by joining + ;; together the regexps + (if (and (looking-at (concat "[^\n\r]*" (caar triggers))) + (funcall (cdar triggers))) + (setq triggers nil) + (setq triggers (cdr triggers))))) + (forward-line)) + (setq chess-engine-last-pos (point))))) (defun chess-ics-strip (string) (while (string-match "[\r\a]" string) |
