diff options
| author | John Wiegley <johnw@newartisans.com> | 2002-04-28 16:09:14 +0000 |
|---|---|---|
| committer | John Wiegley <johnw@newartisans.com> | 2002-04-28 16:09:14 +0000 |
| commit | 80ab4cec14452a641e741d372037dafda16ee871 (patch) | |
| tree | 352324dc62ffbd3c9c651a7154a2e88338144641 /chess-tutorial.el | |
| parent | 7248e5c89f6d53d3f2a4ecf511167af929241f76 (diff) | |
*** no comment ***
Diffstat (limited to 'chess-tutorial.el')
| -rw-r--r-- | chess-tutorial.el | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/chess-tutorial.el b/chess-tutorial.el index a83eed8..565b595 100644 --- a/chess-tutorial.el +++ b/chess-tutorial.el @@ -8,24 +8,31 @@ (chess-message-catalog 'english '((queen-would-take . "The queen would take your knight!") (congratulations . "Congratulations!") - (knight-1-done . "Goal: take all the pawns, without letting the queen take your knight"))) + (knight-1-done . "Goal: take all the pawns, without letting the queen take your knight") + (cannot-take-queen . "You cannot take the queen"))) (defun chess-tutorial-knight-1 (game ignore event &rest args) (if (eq event 'move) (let ((position (chess-game-pos game))) (if (null (chess-pos-search position ?p)) (chess-message 'congratulations) - (when (chess-search-position - position (car (chess-pos-search position ?N)) ?q) - (chess-game-run-hooks chess-module-game 'undo 1) - (chess-display-update nil) - (chess-error 'queen-would-take)))))) + (cond + ((chess-search-position position + (car (chess-pos-search position ?N)) ?q) + (let ((chess-display-handling-event nil)) + (chess-game-undo game 1)) + (chess-error 'queen-would-take)) + ((not (chess-pos-search position ?q)) + (let ((chess-display-handling-event nil)) + (chess-game-undo game 1)) + (chess-error 'cannot-take-queen))))))) (defun chess-tutorial () (interactive) (let* (chess-default-modules (display (chess-create-display t))) (with-current-buffer display + (chess-module-set-leader nil) (chess-game-set-start-position (chess-display-game nil) (chess-fen-to-pos "8/3p1p/2p3p/4q/2p3p/3p1p/8/N w - -")) |
