diff options
| author | Glenn Morris | 2011-04-22 20:07:16 -0700 |
|---|---|---|
| committer | Glenn Morris | 2011-04-22 20:07:16 -0700 |
| commit | 4ffd0d6b569d252e4e807d4e9c9d6a5bd5b08640 (patch) | |
| tree | 26c20c7c4da56fae7e041c9345c76cce1224188c /lisp/play | |
| parent | 81de9236e1daa1fe7dfd0ef9aaaf1e13b6aa74e4 (diff) | |
| parent | be71f8100a71a5b896ef05c32f51a09a3d9e3993 (diff) | |
| download | emacs-4ffd0d6b569d252e4e807d4e9c9d6a5bd5b08640.tar.gz emacs-4ffd0d6b569d252e4e807d4e9c9d6a5bd5b08640.zip | |
Merge from emacs-23; up to 2010-06-09T17:54:28Z!albinus@detlef.
Diffstat (limited to 'lisp/play')
| -rw-r--r-- | lisp/play/doctor.el | 12 | ||||
| -rw-r--r-- | lisp/play/mpuz.el | 42 |
2 files changed, 17 insertions, 37 deletions
diff --git a/lisp/play/doctor.el b/lisp/play/doctor.el index 02d24afb278..54a5a4ef6c9 100644 --- a/lisp/play/doctor.el +++ b/lisp/play/doctor.el | |||
| @@ -115,11 +115,11 @@ | |||
| 115 | (defun doc// (x) x) | 115 | (defun doc// (x) x) |
| 116 | 116 | ||
| 117 | (defmacro doc$ (what) | 117 | (defmacro doc$ (what) |
| 118 | "quoted arg form of doctor-$" | 118 | "Quoted arg form of doctor-$." |
| 119 | `(doctor-$ ',what)) | 119 | `(doctor-$ ',what)) |
| 120 | 120 | ||
| 121 | (defun doctor-$ (what) | 121 | (defun doctor-$ (what) |
| 122 | "Return the car of a list, rotating the list each time" | 122 | "Return the car of a list, rotating the list each time." |
| 123 | (let* ((vv (symbol-value what)) | 123 | (let* ((vv (symbol-value what)) |
| 124 | (first (car vv)) | 124 | (first (car vv)) |
| 125 | (ww (append (cdr vv) (list first)))) | 125 | (ww (append (cdr vv) (list first)))) |
| @@ -832,7 +832,7 @@ Otherwise call the Doctor to parse preceding sentence." | |||
| 832 | (newline arg))) | 832 | (newline arg))) |
| 833 | 833 | ||
| 834 | (defun doctor-read-print nil | 834 | (defun doctor-read-print nil |
| 835 | "top level loop" | 835 | "Top level loop." |
| 836 | (interactive) | 836 | (interactive) |
| 837 | (let ((sent (doctor-readin))) | 837 | (let ((sent (doctor-readin))) |
| 838 | (insert "\n") | 838 | (insert "\n") |
| @@ -850,7 +850,7 @@ Otherwise call the Doctor to parse preceding sentence." | |||
| 850 | sentence)) | 850 | sentence)) |
| 851 | 851 | ||
| 852 | (defun doctor-read-token () | 852 | (defun doctor-read-token () |
| 853 | "read one word from buffer" | 853 | "Read one word from buffer." |
| 854 | (prog1 (intern (downcase (buffer-substring (point) | 854 | (prog1 (intern (downcase (buffer-substring (point) |
| 855 | (progn | 855 | (progn |
| 856 | (forward-word 1) | 856 | (forward-word 1) |
| @@ -1020,7 +1020,7 @@ the subject noun, and return the portion of the sentence following it." | |||
| 1020 | nil)))) | 1020 | nil)))) |
| 1021 | 1021 | ||
| 1022 | (defun doctor-nounp (x) | 1022 | (defun doctor-nounp (x) |
| 1023 | "Returns t if the symbol argument is a noun." | 1023 | "Return t if the symbol argument is a noun." |
| 1024 | (or (doctor-pronounp x) | 1024 | (or (doctor-pronounp x) |
| 1025 | (not (or (doctor-verbp x) | 1025 | (not (or (doctor-verbp x) |
| 1026 | (equal x 'not) | 1026 | (equal x 'not) |
| @@ -1028,7 +1028,7 @@ the subject noun, and return the portion of the sentence following it." | |||
| 1028 | (doctor-modifierp x) )) )) | 1028 | (doctor-modifierp x) )) )) |
| 1029 | 1029 | ||
| 1030 | (defun doctor-pronounp (x) | 1030 | (defun doctor-pronounp (x) |
| 1031 | "Returns t if the symbol argument is a pronoun." | 1031 | "Return t if the symbol argument is a pronoun." |
| 1032 | (memq x '( | 1032 | (memq x '( |
| 1033 | i me mine myself | 1033 | i me mine myself |
| 1034 | we us ours ourselves ourself | 1034 | we us ours ourselves ourself |
diff --git a/lisp/play/mpuz.el b/lisp/play/mpuz.el index 5f4ecce31ca..3e1659628f4 100644 --- a/lisp/play/mpuz.el +++ b/lisp/play/mpuz.el | |||
| @@ -39,7 +39,7 @@ | |||
| 39 | 39 | ||
| 40 | (defcustom mpuz-silent 'error | 40 | (defcustom mpuz-silent 'error |
| 41 | "Set this to nil if you want dings on inputs. | 41 | "Set this to nil if you want dings on inputs. |
| 42 | t means never ding, and `error' means only ding on wrong input." | 42 | The value t means never ding, and `error' means only ding on wrong input." |
| 43 | :type '(choice (const :tag "No" nil) | 43 | :type '(choice (const :tag "No" nil) |
| 44 | (const :tag "Yes" t) | 44 | (const :tag "Yes" t) |
| 45 | (const :tag "If correct" error)) | 45 | (const :tag "If correct" error)) |
| @@ -88,33 +88,14 @@ t means never ding, and `error' means only ding on wrong input." | |||
| 88 | 88 | ||
| 89 | (defvar mpuz-mode-map | 89 | (defvar mpuz-mode-map |
| 90 | (let ((map (make-sparse-keymap))) | 90 | (let ((map (make-sparse-keymap))) |
| 91 | (define-key map "a" 'mpuz-try-letter) | 91 | (mapc (lambda (ch) |
| 92 | (define-key map "b" 'mpuz-try-letter) | 92 | (define-key map (char-to-string ch) 'mpuz-try-letter)) |
| 93 | (define-key map "c" 'mpuz-try-letter) | 93 | "abcdefghijABCDEFGHIJ") |
| 94 | (define-key map "d" 'mpuz-try-letter) | ||
| 95 | (define-key map "e" 'mpuz-try-letter) | ||
| 96 | (define-key map "f" 'mpuz-try-letter) | ||
| 97 | (define-key map "g" 'mpuz-try-letter) | ||
| 98 | (define-key map "h" 'mpuz-try-letter) | ||
| 99 | (define-key map "i" 'mpuz-try-letter) | ||
| 100 | (define-key map "j" 'mpuz-try-letter) | ||
| 101 | (define-key map "A" 'mpuz-try-letter) | ||
| 102 | (define-key map "B" 'mpuz-try-letter) | ||
| 103 | (define-key map "C" 'mpuz-try-letter) | ||
| 104 | (define-key map "D" 'mpuz-try-letter) | ||
| 105 | (define-key map "E" 'mpuz-try-letter) | ||
| 106 | (define-key map "F" 'mpuz-try-letter) | ||
| 107 | (define-key map "G" 'mpuz-try-letter) | ||
| 108 | (define-key map "H" 'mpuz-try-letter) | ||
| 109 | (define-key map "I" 'mpuz-try-letter) | ||
| 110 | (define-key map "J" 'mpuz-try-letter) | ||
| 111 | (define-key map "\C-g" 'mpuz-offer-abort) | 94 | (define-key map "\C-g" 'mpuz-offer-abort) |
| 112 | (define-key map "?" 'describe-mode) | 95 | (define-key map "?" 'describe-mode) |
| 113 | map) | 96 | map) |
| 114 | "Local keymap to use in Mult Puzzle.") | 97 | "Local keymap to use in Mult Puzzle.") |
| 115 | 98 | ||
| 116 | |||
| 117 | |||
| 118 | (defun mpuz-mode () | 99 | (defun mpuz-mode () |
| 119 | "Multiplication puzzle mode. | 100 | "Multiplication puzzle mode. |
| 120 | 101 | ||
| @@ -171,7 +152,7 @@ You may abort a game by typing \\<mpuz-mode-map>\\[mpuz-offer-abort]." | |||
| 171 | "A permutation from [0..9] to [0..9].") | 152 | "A permutation from [0..9] to [0..9].") |
| 172 | 153 | ||
| 173 | (defvar mpuz-letter-to-digit (make-vector 10 0) | 154 | (defvar mpuz-letter-to-digit (make-vector 10 0) |
| 174 | "The inverse of mpuz-digit-to-letter.") | 155 | "The inverse of `mpuz-digit-to-letter'.") |
| 175 | 156 | ||
| 176 | (defmacro mpuz-to-digit (letter) | 157 | (defmacro mpuz-to-digit (letter) |
| 177 | (list 'aref 'mpuz-letter-to-digit letter)) | 158 | (list 'aref 'mpuz-letter-to-digit letter)) |
| @@ -198,17 +179,16 @@ You may abort a game by typing \\<mpuz-mode-map>\\[mpuz-offer-abort]." | |||
| 198 | (defvar mpuz-board (make-vector 10 nil) | 179 | (defvar mpuz-board (make-vector 10 nil) |
| 199 | "The board associates to any digit the list of squares where it appears.") | 180 | "The board associates to any digit the list of squares where it appears.") |
| 200 | 181 | ||
| 201 | (defun mpuz-put-number-on-board (number row &rest l) | 182 | (defun mpuz-put-number-on-board (number row &rest columns) |
| 202 | "Put (last digit of) NUMBER on ROW and COLUMNS of the puzzle board." | 183 | "Put (last digit of) NUMBER on ROW and COLUMNS of the puzzle board." |
| 203 | (let (digit) | 184 | (let (digit) |
| 204 | (while l | 185 | (dolist (column columns) |
| 205 | (setq digit (% number 10) | 186 | (setq digit (% number 10) |
| 206 | number (/ number 10)) | 187 | number (/ number 10)) |
| 207 | (aset mpuz-board digit `((,row . ,(car l)) ,@(aref mpuz-board digit))) | 188 | (aset mpuz-board digit `((,row . ,column) ,@(aref mpuz-board digit)))))) |
| 208 | (setq l (cdr l))))) | ||
| 209 | 189 | ||
| 210 | (defun mpuz-check-all-solved (&optional row col) | 190 | (defun mpuz-check-all-solved (&optional row col) |
| 211 | "Check whether all digits have been solved. Return t if yes." | 191 | "Check whether all digits have been solved. Return t if yes." |
| 212 | (catch 'solved | 192 | (catch 'solved |
| 213 | (let (A B1 B2 C D E squares) | 193 | (let (A B1 B2 C D E squares) |
| 214 | (and mpuz-solve-when-trivial | 194 | (and mpuz-solve-when-trivial |
| @@ -294,7 +274,7 @@ You may abort a game by typing \\<mpuz-mode-map>\\[mpuz-offer-abort]." | |||
| 294 | "The general picture of the puzzle screen, as a string.") | 274 | "The general picture of the puzzle screen, as a string.") |
| 295 | 275 | ||
| 296 | (defun mpuz-create-buffer () | 276 | (defun mpuz-create-buffer () |
| 297 | "Create (or recreate) the puzzle buffer. Return it." | 277 | "Create (or recreate) the puzzle buffer. Return it." |
| 298 | (let ((buf (get-buffer-create "*Mult Puzzle*")) | 278 | (let ((buf (get-buffer-create "*Mult Puzzle*")) |
| 299 | (face '(face mpuz-text)) | 279 | (face '(face mpuz-text)) |
| 300 | buffer-read-only) | 280 | buffer-read-only) |