]> code.delx.au - gnu-emacs/blobdiff - lisp/play/landmark.el
(s-region-bind): Doc fix.
[gnu-emacs] / lisp / play / landmark.el
index 3b4734a641e0dbae83295fe28eed5a2cf4dbb6a3..feab5de1bc3c46c2d3c74cb7bd775c87ca37af94 100644 (file)
@@ -1,10 +1,10 @@
 ;;; landmark.el --- neural-network robot that learns landmarks
 
-;; Copyright (c) 1996, 1997, 2000 Free Software Foundation, Inc.
+;; Copyright (c) 1996, 1997, 2000, 2003, 2005 Free Software Foundation, Inc.
 
-;; Author: Terrence Brannon <brannon@rana.usc.edu>
+;; Author: Terrence Brannon (was: <brannon@rana.usc.edu>)
 ;; Created: December 16, 1996 - first release to usenet
-;; Keywords: gomoku neural network adaptive search chemotaxis
+;; Keywords: gomoku, neural network, adaptive search, chemotaxis
 
 ;;;_* Usage
 ;;; Just type
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 
-;;;_* Commentary
+;;; Commentary:
 ;;; Lm is a relatively non-participatory game in which a robot
 ;;; attempts to maneuver towards a tree at the center of the window
 ;;; based on unique olfactory cues from each of the 4 directions. If
@@ -62,6 +62,8 @@
 
 ;;;_* From Gomoku
 
+;;; Code:
+
 (defgroup lm nil
   "Neural-network robot that learns landmarks."
   :prefix "lm-"
   (define-key lm-mode-map [mouse-2] 'lm-mouse-play)
   (define-key lm-mode-map [drag-mouse-2] 'lm-mouse-play)
 
-  (substitute-key-definition 'previous-line 'lm-move-up
-                            lm-mode-map (current-global-map))
-  (substitute-key-definition 'next-line 'lm-move-down
-                            lm-mode-map (current-global-map))
-  (substitute-key-definition 'beginning-of-line 'lm-beginning-of-line
-                            lm-mode-map (current-global-map))
-  (substitute-key-definition 'end-of-line 'lm-end-of-line
-                            lm-mode-map (current-global-map))
-  (substitute-key-definition 'undo 'lm-human-takes-back
-                            lm-mode-map (current-global-map))
-  (substitute-key-definition 'advertised-undo 'lm-human-takes-back
-                            lm-mode-map (current-global-map)))
+  (define-key lm-mode-map [remap previous-line] 'lm-move-up)
+  (define-key lm-mode-map [remap next-line] 'lm-move-down)
+  (define-key lm-mode-map [remap beginning-of-line] 'lm-beginning-of-line)
+  (define-key lm-mode-map [remap end-of-line] 'lm-end-of-line)
+  (define-key lm-mode-map [remap undo] 'lm-human-takes-back)
+  (define-key lm-mode-map [remap advertised-undo] 'lm-human-takes-back))
 
 (defvar lm-emacs-won ()
   "*For making font-lock use the winner's face for the line.")
 (put 'lm-mode 'front-sticky
      (put 'lm-mode 'rear-nonsticky '(intangible)))
 (put 'lm-mode 'intangible 1)
+;; This one is for when they set view-read-only to t: Landmark cannot
+;; allow View Mode to be activated in its buffer.
+(put 'lm-mode 'mode-class 'special)
 
 (defun lm-mode ()
   "Major mode for playing Lm against Emacs.
@@ -249,6 +248,7 @@ Other useful commands:
 Entry to this mode calls the value of `lm-mode-hook' if that value
 is non-nil.  One interesting value is `turn-on-font-lock'."
   (interactive)
+  (kill-all-local-variables)
   (setq major-mode 'lm-mode
        mode-name "Lm")
   (lm-display-statistics)
@@ -256,7 +256,7 @@ is non-nil.  One interesting value is `turn-on-font-lock'."
   (make-local-variable 'font-lock-defaults)
   (setq font-lock-defaults '(lm-font-lock-keywords t))
   (toggle-read-only t)
-  (run-hooks 'lm-mode-hook))
+  (run-mode-hooks 'lm-mode-hook))
 
 
 ;;;_ +  THE SCORE TABLE.
@@ -943,11 +943,11 @@ mouse-1: get robot moving, mouse-2: play on this square")))
       (insert-char ?\n lm-square-height))
     (or (eq (char-after 1) ?.)
        (put-text-property 1 2 'point-entered
-                          (lambda (x x) (if (bobp) (forward-char)))))
+                          (lambda (x y) (if (bobp) (forward-char)))))
     (or intangible
        (put-text-property point (point) 'intangible 2))
     (put-text-property point (point) 'point-entered
-                      (lambda (x x) (if (eobp) (backward-char))))
+                      (lambda (x y) (if (eobp) (backward-char))))
     (put-text-property (point-min) (point) 'category 'lm-mode))
   (lm-goto-xy (/ (1+ n) 2) (/ (1+ m) 2)) ; center of the board
   (sit-for 0))                         ; Display NOW
@@ -1704,4 +1704,5 @@ Use \\[describe-mode] for more info."
 
 (provide 'landmark)
 
+;;; arch-tag: ae5031be-96e6-459e-a3df-1df53117d3f2
 ;;; landmark.el ends here