;;; landmark.el --- neural-network robot that learns landmarks
-;; Copyright (C) 1996-1997, 2000-2011 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1997, 2000-2013 Free Software Foundation, Inc.
;; Author: Terrence Brannon (was: <brannon@rana.usc.edu>)
;; Created: December 16, 1996 - first release to usenet
;; concise problem description.
;;;_* Require
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
;;;_* From Gomoku
;; look rectangular, but spacings SHOULD be at least 2 (MUST BE at least 1).
(defconst landmark-square-width 2
- "*Horizontal spacing between squares on the Landmark board.")
+ "Horizontal spacing between squares on the Landmark board.")
(defconst landmark-square-height 1
- "*Vertical spacing between squares on the Landmark board.")
+ "Vertical spacing between squares on the Landmark board.")
(defconst landmark-x-offset 3
- "*Number of columns between the Landmark board and the side of the window.")
+ "Number of columns between the Landmark board and the side of the window.")
(defconst landmark-y-offset 1
- "*Number of lines between the Landmark board and the top of the window.")
+ "Number of lines between the Landmark board and the top of the window.")
;;;_ + LANDMARK MODE AND KEYMAP.
(defvar landmark-emacs-won ()
- "*For making font-lock use the winner's face for the line.")
+ "For making font-lock use the winner's face for the line.")
(defface landmark-font-lock-face-O '((((class color)) :foreground "red")
(t :weight bold))
- "Face to use for Emacs' O."
+ "Face to use for Emacs's O."
:version "22.1"
:group 'landmark)
("[-|/\\]" 0 (if landmark-emacs-won
'landmark-font-lock-face-O
'landmark-font-lock-face-X)))
- "*Font lock rules for Landmark.")
+ "Font lock rules for Landmark.")
(put 'landmark-mode 'front-sticky
(put 'landmark-mode 'rear-nonsticky '(intangible)))
best-square square
score-max score)
(aset landmark-score-table square -1))) ; no: kill it !
- ;; If score is equally good, choose randomly. But first check freeness:
+ ;; If score is equally good, choose randomly. But first check freedom:
((not (zerop (aref landmark-board square)))
(aset landmark-score-table square -1))
((zerop (random (setq count (1+ count))))
(insert-char ?\n landmark-square-height))
(or (eq (char-after 1) ?.)
(put-text-property 1 2 'point-entered
- (lambda (x y) (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 y) (if (eobp) (backward-char))))
+ (lambda (_x _y) (if (eobp) (backward-char))))
(put-text-property (point-min) (point) 'category 'landmark-mode))
(landmark-goto-xy (/ (1+ n) 2) (/ (1+ m) 2)) ; center of the board
(sit-for 0)) ; Display NOW
(t x)))
(defun landmark-y (direction)
- (let ((noise (put direction 'noise (landmark-noise))))
- (put direction 'y_t
- (if (> (get direction 's) 0.0)
- 1.0
- 0.0))))
+ (put direction 'noise (landmark-noise))
+ (put direction 'y_t
+ (if (> (get direction 's) 0.0)
+ 1.0
+ 0.0)))
(defun landmark-update-normal-weights (direction)
(mapc (lambda (target-direction)
landmark-directions))
(defun landmark-update-naught-weights (direction)
- (mapc (lambda (target-direction)
+ (mapc (lambda (_target-direction)
(put direction 'w0
(landmark-f
(+
(put 'z 't-1 (get 'z 't))
(put 'z 't (calc-smell-internal 'landmark-tree))
(if (= (- (get 'z 't) (get 'z 't-1)) 0.0)
- (incf landmark-no-payoff)
+ (cl-incf landmark-no-payoff)
(setf landmark-no-payoff 0)))
(defun landmark-store-old-y_t ()
(landmark-e forward-char)
(landmark-w backward-char)))
(landmark-plot-square (landmark-point-square) 1)
- (incf landmark-number-of-moves)
+ (cl-incf landmark-number-of-moves)
(if landmark-output-moves
(message "Moves made: %d" landmark-number-of-moves)))
((not landmark-game-in-progress)
(landmark-prompt-for-other-game))
(t
- (let (square score)
+ (let (square)
(setq square (landmark-point-square))
(cond ((null square)
(error "Your point is not on a square. Retry!"))
;;;_ - something which doesn't work
; no-a-worka!!
-;(defum landmark-sum-list (list)
+;(defun landmark-sum-list (list)
; (if (> (length list) 0)
; (+ (car list) (landmark-sum-list (cdr list)))
; 0))
; this a worka!
; (eval (cons '+ list))
;;;_ - landmark-set-landmark-signal-strengths ()
-;;; on a screen higher than wide, I noticed that the robot would amble
-;;; left and right and not move forward. examining *landmark-blackbox*
-;;; revealed that there was no scent from the north and south
-;;; landmarks, hence, they need less factoring down of the effect of
-;;; distance on scent.
+;; on a screen higher than wide, I noticed that the robot would amble
+;; left and right and not move forward. examining *landmark-blackbox*
+;; revealed that there was no scent from the north and south
+;; landmarks, hence, they need less factoring down of the effect of
+;; distance on scent.
(defun landmark-set-landmark-signal-strengths ()
(setq landmark-tree-r (* (sqrt (+ (square landmark-cx) (square landmark-cy))) 1.5))
;;;allout-layout: (0 : -1 -1 0)
;;;End:
-(random t)
-
(provide 'landmark)
;;; landmark.el ends here