diff options
| author | John Wiegley <johnw@newartisans.com> | 2002-04-10 23:55:13 +0000 |
|---|---|---|
| committer | John Wiegley <johnw@newartisans.com> | 2002-04-10 23:55:13 +0000 |
| commit | a0769011c2a98841156559aa37978156766cc09f (patch) | |
| tree | 407832c3c0fac049e9e7d567614894cc47e76f3c /chess-crafty.el | |
| parent | 5fbbfaf36f1dc7da3c7539568fe473bbf079c513 (diff) | |
Added support for aborting a game. Use A or N from a display.
Diffstat (limited to 'chess-crafty.el')
| -rw-r--r-- | chess-crafty.el | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/chess-crafty.el b/chess-crafty.el index 12ffb3a..b14db83 100644 --- a/chess-crafty.el +++ b/chess-crafty.el @@ -29,7 +29,7 @@ (lambda () (funcall chess-engine-response-handler 'move (chess-engine-convert-algebraic (match-string 2)))))) - (cons "Illegal move:\\s-*\\(.*\\)" + (cons "\\(Illegal move\\|unrecognized/illegal command\\):\\s-*\\(.*\\)" (function (lambda () (signal 'chess-illegal (match-string 1))))))) @@ -65,9 +65,8 @@ (delete-file file)))) ((eq event 'ready) - (let ((game (chess-engine-game nil))) - (if game - (chess-game-set-data game 'active t)))) + (and (chess-engine-game nil) + (chess-game-set-data (chess-engine-game nil) 'active t))) ((eq event 'setup-pos) (chess-engine-send nil (format "setboard %s\n" @@ -83,6 +82,11 @@ ((eq event 'pass) (chess-engine-send nil "go\n")) + ((memq event '(abort resign)) + (chess-engine-send nil "new\n") + (and (chess-engine-game nil) + (chess-engine-set-start-position nil))) + ((eq event 'move) (chess-engine-send nil (concat (chess-ply-to-algebraic (car args)) "\n"))))) |
