;ELC   
;;; Compiled by pot@pot.cnuce.cnr.it on Tue Mar 18 15:49:42 2003
;;; from file /home/pot/gnu/emacs-pretest.new/lisp/play/landmark.el
;;; in Emacs version 21.3
;;; with bytecomp version 2.85.4.1
;;; with all optimizations.

;;; This file uses dynamic docstrings, first added in Emacs 19.29.
(if (and (boundp 'emacs-version)
	 (< (aref emacs-version (1- (length emacs-version))) ?A)
	 (or (and (boundp 'epoch::version) epoch::version)
	     (string-lessp emacs-version "19.29")))
    (error "`landmark.el' was compiled for Emacs 19.29 or later"))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(custom-declare-group 'lm nil "Neural-network robot that learns landmarks." :prefix "lm-" :group 'games)
#@36 Number of columns on the Lm board.
(defvar lm-board-width nil (#$ . 728))
#@34 Number of lines on the Lm board.
(defvar lm-board-height nil (#$ . 808))
#@52 Vector recording the actual state of the Lm board.
(defvar lm-board nil (#$ . 887))
#@28 Length of lm-board vector.
(defvar lm-vector-length nil (#$ . 977))
#@47 After how many moves will Emacs offer a draw?
(defvar lm-draw-limit nil (#$ . 1051))
#@54 This is the x coordinate of the center of the board.
(defvar lm-cx 0 (#$ . 1142))
#@54 This is the y coordinate of the center of the board.
(defvar lm-cy 0 (#$ . 1230))
#@47 This is the x dimension of the playing board.
(defvar lm-m 0 (#$ . 1318))
#@47 This is the y dimension of the playing board.
(defvar lm-n 0 (#$ . 1398))
#@69 Translate X, Y cartesian coords into the corresponding board index.
(defalias 'lm-xy-to-index #[(x y) "	_\n\\\\\207" [y lm-board-width x] 2 (#$ . 1478)])
#@46 Return corresponding x-coord of board INDEX.
(defalias 'lm-index-to-x #[(index) "	T\246\207" [index lm-board-width] 2 (#$ . 1640)])
#@46 Return corresponding y-coord of board INDEX.
(defalias 'lm-index-to-y #[(index) "	T\245\207" [index lm-board-width] 2 (#$ . 1779)])
#@61 Create the lm-board vector and fill it with initial values.
(defalias 'lm-init-board #[nil "\305\306\"\306S\fX\203# 	\307I\210	\n\307I\210T\nS\202\n *\306\306W\205; 	\307I\210\f\\\310\\\211\202' )\207" [lm-vector-length lm-board ii i lm-board-width make-vector 0 -1 1] 4 (#$ . 1918)])
#@54 *Horizontal spacing between squares on the Lm board.
(defconst lm-square-width 2 (#$ . -2224))
#@52 *Vertical spacing between squares on the Lm board.
(defconst lm-square-height 1 (#$ . -2325))
#@69 *Number of columns between the Lm board and the side of the window.
(defconst lm-x-offset 3 (#$ . -2425))
#@66 *Number of lines between the Lm board and the top of the window.
(defconst lm-y-offset 1 (#$ . -2537))
#@54 If non-nil, its value is called on entry to Lm mode.
(custom-declare-variable 'lm-mode-hook 'nil '(#$ . 2646) :type 'hook :group 'lm)
#@33 Local keymap to use in Lm mode.
(defvar lm-mode-map nil (#$ . 2786))
(byte-code "\204\331 \301 \302\303\304#\210\302\305\306#\210\302\307\310#\210\302\311\312#\210\302\313\314#\210\302\315\316#\210\302\317\320#\210\302\321\322#\210\302\323\304#\210\302\324\306#\210\302\325\310#\210\302\326\312#\210\302\327\314#\210\302\330\316#\210\302\331\320#\210\302\332\322#\210\302\333\320#\210\302\334\322#\210\302\335\336#\210\302\337\336#\210\302\340\341#\210\302\342\341#\210\302\343\344#\210\302\345\344#\210\302\346\344#\210\302\347\350#\210\302\351\350#\210\352\353\322\354 $\210\352\355\320\354 $\210\352\356\357\354 $\210\352\360\361\354 $\210\352\362\363\354 $\210\352\364\363\354 $\210\301\207" [lm-mode-map make-sparse-keymap define-key "y" lm-move-nw "u" lm-move-ne "b" lm-move-sw "n" lm-move-se "h" backward-char "l" forward-char "j" lm-move-down "k" lm-move-up [kp-7] [kp-9] [kp-1] [kp-3] [kp-4] [kp-6] [kp-2] [kp-8] "" "" "X" lm-human-plays "x" " " lm-start-robot [down-mouse-1] [drag-mouse-1] lm-click [mouse-1] [down-mouse-2] [mouse-2] lm-mouse-play [drag-mouse-2] substitute-key-definition previous-line current-global-map next-line beginning-of-line lm-beginning-of-line end-of-line lm-end-of-line undo lm-human-takes-back advertised-undo] 5)
#@59 *For making font-lock use the winner's face for the line.
(defvar lm-emacs-won nil (#$ . -4082))
#@28 *Face to use for Emacs' O.
(defvar lm-font-lock-face-O (byte-code "\300 \205\n \301\302!\303D\207" [display-color-p facemenu-get-face fg:red bold] 2) (#$ . -4185))
#@26 *Face to use for your X.
(defvar lm-font-lock-face-X (byte-code "\300 \205\n \301\302!\303D\207" [display-color-p facemenu-get-face fg:green bold] 2) (#$ . -4355))
#@26 *Font lock rules for Lm.
(defvar lm-font-lock-keywords '(("O" . lm-font-lock-face-O) ("X" . lm-font-lock-face-X) ("[-|/\\]" 0 (if lm-emacs-won lm-font-lock-face-O lm-font-lock-face-X))) (#$ . -4525))
(byte-code "\300\301\302\300\301\303\304##\210\300\301\305\306#\210\300\301\307\310#\207" [put lm-mode front-sticky rear-nonsticky (intangible) intangible 1 mode-class special] 7)
#@491 Major mode for playing Lm against Emacs.
You and Emacs play in turn by marking a free square.  You mark it with X
and Emacs marks it with O.  The winner is the first to get five contiguous
marks horizontally, vertically or in diagonal.

You play by moving the cursor over the square you choose and hitting \[lm-human-plays].

Other useful commands:
\{lm-mode-map}
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'.
(defalias 'lm-mode #[nil "\304\305\306 \210\307\n!\210\310\303!\210\311\312\313!\210\314\315!\207" [major-mode mode-name lm-mode-map font-lock-defaults lm-mode "Lm" lm-display-statistics use-local-map make-local-variable (lm-font-lock-keywords t) toggle-read-only t run-hooks lm-mode-hook] 2 (#$ . 4912) nil])
#@56 Vector recording the actual score of the free squares.
(defvar lm-score-table nil (#$ . 5721))
#@27 Score of an empty qtuple.
(defconst nil-score 7 (#$ . 5822))
#@37 Score of a qtuple containing one X.
(defconst Xscore 15 (#$ . 5889))
#@39 Score of a qtuple containing two X's.
(defconst XXscore 400 (#$ . 5964))
#@41 Score of a qtuple containing three X's.
(defconst XXXscore 1800 (#$ . 6043))
#@40 Score of a qtuple containing four X's.
(defconst XXXXscore 100000 (#$ . 6126))
#@37 Score of a qtuple containing one O.
(defconst Oscore 35 (#$ . 6211))
#@39 Score of a qtuple containing two O's.
(defconst OOscore 800 (#$ . 6286))
#@41 Score of a qtuple containing three O's.
(defconst OOOscore 15000 (#$ . 6365))
#@40 Score of a qtuple containing four O's.
(defconst OOOOscore 800000 (#$ . 6449))
#@52 Vector associating qtuple contents to their score.
(defconst lm-score-trans-table (byte-code "\306	\n\f\307\307\211\211\211\211\307\211\211\211\211	\307\211\211\211\211\n\307\211\211\211\211\211&\207" [nil-score Xscore XXscore XXXscore XXXXscore Oscore vector 0 OOscore OOOscore OOOOscore] 32) (#$ . 6534))
#@56 Threshold score beyond which an Emacs move is winning.
(defconst lm-winning-threshold OOOOscore (#$ . 6855))
#@55 Threshold score beyond which a human move is winning.
(defconst lm-loosing-threshold XXXXscore (#$ . 6970))
#@66 Compute index of free square with highest score, or nil if none.
(defalias 'lm-strongest-square #[nil "\306\211\307\310\211\"\307	\"\311\211\fX\203x HW\204q H\211V\203M \312H!\203D \310\n\202q \313I\210\202q \312H!\204_ \313I\210\202q \312\314T\211!!\203q \nT\211\202 .\207" [lm-board-width lm-board-height score best-square end square 0 lm-xy-to-index 1 nil zerop -1 random count score-max lm-score-table lm-board] 7 (#$ . 7084)])
#@49 Recorded initial value of previous score table.
(defvar lm-saved-score-table nil (#$ . 7574))
#@41 Recorded value of previous board width.
(defvar lm-saved-board-width nil (#$ . 7674))
#@42 Recorded value of previous board height.
(defvar lm-saved-board-height nil (#$ . 7766))
#@64 Create the score table vector and fill it with initial values.
(defalias 'lm-init-score-table #[nil "\203 	\nU\203 \fU\203 \306!\211\207\307\310_\"\311\211\211\211\211\211	T\312\245T\312\245\313^\313^\314\314X\203v \314\314X\203m \315\"\210T\211\202W T\211\202M X\203\241 \314\314X\203\230 \315\"\210T\211\202\202 T\211\202x .\306!	\211\207" [lm-saved-score-table lm-board-width lm-saved-board-width lm-board-height lm-saved-board-height lm-score-table copy-sequence make-vector 20 nil 2 4 1 lm-init-square-score lm-vector-length nil-score maxj2 maxi2 maxj maxi j i] 7 (#$ . 7860)])
#@53 Return the number of qtuples containing square I,J.
(defalias 'lm-nb-qtuples #[(i j) "\306S^\306	Z^\306\nS^\306\nZ^\n\211\n\\\307]\310^\f\\\307]\310^\\^\n\f^\\\307]\310^\\\n^\f^\\\307]\310^\\\311\\,\207" [i lm-board-width j lm-board-height down up 4 3 8 -12 right left] 7 (#$ . 8532)])
#@60 Give initial score to square I,J and to its mirror images.
(defalias 'lm-init-square-score #[(i j) "	ZT\nZT\306	\"\f\307H_	\n\310	\"I\210\310\n\"I\210\310		\"I\210\310\n	\"I+\207" [lm-board-width i lm-board-height j lm-score-trans-table sc lm-nb-qtuples 0 lm-xy-to-index jj ii lm-score-table] 5 (#$ . 8842)])
#@60 Update score table after SQUARE received a DVAL increment.
(defalias 'lm-update-score-table #[(square dval) "\306!\307!\310\311	Z]\310\311\nZ]\312	Z\313Z^\312\nZ\313Z^\314\311\312&\210\314\f\312\311&\210\314\f]^\311\211&\210\314\311\nZ\310]	Z]\312	\315Z^\nZ\313Z^\316\311&.\207" [square x y imin jmin lm-board-width lm-index-to-x lm-index-to-y -4 1 0 4 lm-update-score-in-direction 5 -1 imax lm-board-height jmax dval] 7 (#$ . 9181)])
#@203 Update scores for all squares in the qtuples in range.
That is, those between the LEFTth square and the RIGHTth after SQUARE,
along the DX, DY direction, considering that DVAL has been added on SQUARE.
(defalias 'lm-update-score-in-direction #[(left right square dx dy dval) "	V\206\273 \306\211\211\211\211\211\f\307\"\f\f_\\	\f_\\\f\310_\\\311\fX\203U H\\\f\\\211\202= X\205\271 HZHZ\312\n!\204\233 \211\fX\203\233 \312H!\203\220 H\n\\I\210\f\\\211\202t \f\f\\H[\\\fH\\\f\\\211\202W .\207" [left right delta count square2 square1 nil lm-xy-to-index 4 0 zerop square0 depl dx dy square lm-board lm-score-trans-table dval lm-score-table] 7 (#$ . 9666)])
#@35 Non-nil if a game is in progress.
(defvar lm-game-in-progress nil (#$ . 10420))
#@66 A record of all moves that have been played during current game.
(defvar lm-game-history nil (#$ . 10506))
#@49 Number of moves already played in current game.
(defvar lm-number-of-moves nil (#$ . 10619))
#@58 Number of moves already played by human in current game.
(defvar lm-number-of-human-moves nil (#$ . 10718))
#@32 Non-nil if Emacs played first.
(defvar lm-emacs-played-first nil (#$ . 10832))
#@52 Non-nil if Human took back a move during the game.
(defvar lm-human-took-back nil (#$ . 10917))
#@49 Non-nil if Human refused Emacs offer of a draw.
(defvar lm-human-refused-draw nil (#$ . 11019))
#@53 Non-nil if Emacs is in the middle of a computation.
(defvar lm-emacs-is-computing nil (#$ . 11121))
#@43 Initialize a new game on an N by M board.
(defalias 'lm-start-game #[(n m) "\306\306\n\f\f\307\\\nT_T\n\f_\310_\311\245\312\312\313\313\312\312\312\314\n\f\"\210\315 \210\316 \210\312\211\207" [lm-emacs-is-computing lm-game-in-progress n lm-board-width m lm-board-height t 2 7 10 nil 0 lm-init-display lm-init-score-table lm-init-board lm-vector-length lm-draw-limit lm-emacs-won lm-game-history lm-number-of-moves lm-number-of-human-moves lm-emacs-played-first lm-human-took-back lm-human-refused-draw] 3 (#$ . 11227)])
#@47 Go to SQUARE, play VAL and update everything.
(defalias 'lm-play-move #[(square val &optional dont-update-score) "\306	\307U\203 \nT\202 \310!\203 \306HBBT\311	\"\210	I\210\204? \312	\"\210\313I\210\314\211\207" [lm-emacs-is-computing val lm-number-of-human-moves lm-number-of-moves lm-emacs-played-first square t 1 zerop lm-plot-square lm-update-score-table -1 nil lm-score-table lm-game-history lm-board dont-update-score] 3 (#$ . 11777)])
#@44 Take back last move and update everything.
(defalias 'lm-take-back #[nil "\306	@\211@\fH\211\307U\203 \fS\f	AS\310\311\"\210\f\311I\210\312[\"\210\nAI\210+\313\211\207" [lm-emacs-is-computing lm-game-history last-move square lm-board oldval t 1 lm-plot-square 0 lm-update-score-table nil lm-number-of-human-moves lm-number-of-moves lm-score-table] 4 (#$ . 12253)])
#@49 The number of times that landmark has been run.
(defvar lm-number-of-trials 0 (#$ . 12645))
#@46 The total number of moves made in all games.
(defvar lm-sum-of-moves 0 (#$ . 12743))
#@44 Number of games Emacs won in this session.
(defvar lm-number-of-emacs-wins 0 (#$ . 12834))
#@42 Number of games you won in this session.
(defvar lm-number-of-human-wins 0 (#$ . 12931))
#@48 Number of games already drawn in this session.
(defvar lm-number-of-draws 0 (#$ . 13026))
#@41 Terminate the current game with RESULT.
(defalias 'lm-terminate-game #[(result) "T	\n\\\305=\203 \306\307!\210\310 \210\311\211\207" [lm-number-of-trials lm-sum-of-moves lm-number-of-moves result lm-game-in-progress crash-game message "Sorry, I have been interrupted and cannot resume that game..." lm-display-statistics nil] 2 (#$ . 13122)])
#@56 What to do when Emacs detects it has been interrupted.
(defalias 'lm-crash-game #[nil "\301\302\303!\210\304\305!\210\306 \207" [lm-emacs-is-computing nil lm-terminate-game crash-game sit-for 4 lm-prompt-for-other-game] 2 (#$ . 13477)])
#@38 Compute Emacs next move and play it.
(defalias 'lm-emacs-plays #[nil "\306 \210\203\n \307 \207	\204 \310 \207\311\312!\210\313\211\314 \211\204& \315\316!\202i \fH\317\320\"\210\nY\203C \321\322\320\"\210\315\323!\202i \324\n!\203O \315\316!\202i V\203g \204g \325 \203g \315\326!\202i \327 *\207" [lm-emacs-is-computing lm-game-in-progress score square lm-score-table lm-winning-threshold lm-switch-to-window lm-crash-game lm-prompt-for-other-game message "Let me think..." nil lm-strongest-square lm-terminate-game nobody-won lm-play-move 6 t lm-find-filled-qtuple emacs-won zerop lm-offer-a-draw draw-agreed lm-prompt-for-move lm-emacs-won lm-number-of-moves lm-draw-limit lm-human-refused-draw] 4 (#$ . 13721) nil])
#@41 Position at the square where you click.
(defalias 'lm-click #[(click) "\306\307	8:\203 \307\202 \310	8)\211\311\n8)!\205\211 \310\n8:\203- \310\n8@\2020 \310\n8)\247\205\211 \312\311\n8)!\205\211 \313!\211\205\211 \314@Z\310Z\315 \\\f\\\f\307\246\\\f\307\245\\\f\245\310]^AZ\310Z\316\317\310\320 \")\\\\\307\246\\\307\245\\\245\310]^\"\207" [click event position lm-x-offset lm-square-width lm-board-width windowp 2 1 0 select-window posn-col-row lm-goto-xy window-hscroll t count-lines window-start lm-y-offset inhibit-point-motion-hooks lm-square-height lm-board-height] 6 (#$ . 14466) "e"])
#@37 Play at the square where you click.
(defalias 'lm-mouse-play #[(click) "\301!\205 \302 \207" [click lm-click lm-human-plays] 2 (#$ . 15096) "e"])
#@180 Signal to the Lm program that you have played.
You must have put the cursor on the square where you want to play.
If the game is finished, this command requests for another game.
(defalias 'lm-human-plays #[nil "\306 \210\203\n \307 \207	\204 \310 \207\311\211\312 \211\204\" \313\314!\202O \315\fH!\2040 \313\316!\202O H\317\320\"\210\nY\203M \321\320\"\203M \322\323!\202O \324 *\207" [lm-emacs-is-computing lm-game-in-progress score square lm-board lm-score-table lm-switch-to-window lm-crash-game lm-prompt-for-other-game nil lm-point-square error "Your point is not on a square. Retry !" zerop "Your point is not on a free square. Retry !" lm-play-move 1 lm-find-filled-qtuple lm-terminate-game human-won lm-emacs-plays lm-loosing-threshold] 4 (#$ . 15251) nil])
#@69 Signal to the Lm program that you wish to take back your last move.
(defalias 'lm-human-takes-back #[nil "\305 \210\203\n \306 \207	\204 \307\310!\210\311\312!\210\313 \207\314\n!\203# \307\315!\207\307\316!\210\317\n\f\nU\2037 \320 \210\202+ )\321 \207" [lm-emacs-is-computing lm-game-in-progress lm-number-of-human-moves lm-human-took-back number lm-switch-to-window lm-crash-game message "Too late for taking back..." sit-for 4 lm-prompt-for-other-game zerop "You have not played yet... Your move ?" "One moment, please..." t lm-take-back lm-prompt-for-move] 2 (#$ . 16038) nil])
#@55 Signal to the Lm program that you may want to resign.
(defalias 'lm-human-resigns #[nil "\302 \210\203\n \303 \207	\204 \304\305!\207\306\307!\203 \310\311!\207\306\312!\203% \313 \207\310\311!\207" [lm-emacs-is-computing lm-game-in-progress lm-switch-to-window lm-crash-game message "There is no game in progress" y-or-n-p "You mean, you resign " lm-terminate-game human-resigned "You mean, we continue " lm-prompt-for-move] 2 (#$ . 16631) nil])
#@44 Display a message asking for Human's move.
(defalias 'lm-prompt-for-move #[nil "\301\302!\203 \303\202\f \304!\210\212\305 q)\207" [lm-number-of-human-moves message zerop "Your move ? (move to a free square and hit X, RET ...)" "Your move ?" other-buffer] 3 (#$ . 17087)])
#@37 Ask for another game, and start it.
(defalias 'lm-prompt-for-other-game #[nil "\300\301!\203 \300\302!\203 \303\304!\207\303\305!\207\306\307!\207" [y-or-n-p "Another game " "Retain learned weights " lm 2 1 message "Chicken !"] 2 (#$ . 17368)])
#@49 Offer a draw and return t if Human accepted it.
(defalias 'lm-offer-a-draw #[nil "\301\302!\206\n \303\211?\207" [lm-human-refused-draw y-or-n-p "I offer you a draw. Do you accept it " t] 2 (#$ . 17621)])
#@54 Largest possible board width for the current window.
(defalias 'lm-max-width #[nil "\302\303 !ZZ\304Z	\245T\207" [lm-x-offset lm-square-width window-width selected-window 1] 2 (#$ . 17833)])
#@55 Largest possible board height for the current window.
(defalias 'lm-max-height #[nil "\302\303 !ZZ\304Z	\245T\207" [lm-y-offset lm-square-height window-height selected-window 2] 2 (#$ . 18032)])
#@38 Return the board row where point is.
(defalias 'lm-point-y #[nil "\303\304\305`\"	Zn\203 \306\202 \305Z\n\245T)\207" [inhibit-point-motion-hooks lm-y-offset lm-square-height t count-lines 1 0] 3 (#$ . 18235)])
#@45 Return the index of the square point is on.
(defalias 'lm-point-square #[nil "\303\304i	Z\n\245T\305 \")\207" [inhibit-point-motion-hooks lm-x-offset lm-square-width t lm-xy-to-index lm-point-y] 3 (#$ . 18454)])
#@36 Move point to square number INDEX.
(defalias 'lm-goto-square #[(index) "\301\302!\303!\"\207" [index lm-goto-xy lm-index-to-x lm-index-to-y] 4 (#$ . 18673)])
#@38 Move point to square at X, Y coords.
(defalias 'lm-goto-xy #[(x y) "\306\307	\nS_\\\310\\!\210)\311\f\nS_\\!\207" [inhibit-point-motion-hooks lm-y-offset lm-square-height y lm-x-offset lm-square-width t goto-line 1 move-to-column x] 4 (#$ . 18839)])
#@71 Draw 'X', 'O' or '.' on SQUARE depending on VALUE, leave point there.
(defalias 'lm-plot-square #[(square value) "\304U\204\n \305	!\210\306\211\307\304U\203 \310\202H \311U\203# \312\202H \313U\203- \314\202H \315U\2037 \316\202H \317U\203A \320\202H \321U\205H \322!\210\323!\203W \324`S`\325#\210\326\304!\210\327u\210*\330\331!\207" [value square inhibit-point-motion-hooks inhibit-read-only 1 lm-goto-square t insert-and-inherit 46 2 78 3 83 4 69 5 87 6 94 zerop add-text-properties (mouse-face highlight help-echo "mouse-1: get robot moving, mouse-2: play on this square") delete-char -1 sit-for 0] 4 (#$ . 19099)])
#@29 Display an N by M Lm board.
(defalias 'lm-init-display #[(n m) "\306p!\210\307\310\311\307\311\211!\"\312#$\246!\203# $\2021 #$\246$\\\310\\\313\245\313]%\314 \210\315&!\210'#$Z\nS\211\316Y\203\247 \317\320	$\\\211iZ%\245\"\210\317\321	iZ\"\210\f?\211\203r \322!`\304\313$\210\312\n!\203\227 \313ZU\203\227 \323Y\203\224 \324p`#\210\313Z\211\202\201 db\210`!\325c\210\326!`\327#\210\202D S\211\316V\203\303 SU\203\272 !\317\330(\"\210\202; \310f\331=\204\321 \322\310\313\332\333$\210\f\204\335 \322!`\304\313$\210\322!`\332\334$\210\322e`\335\336$\210.\337'T\313\245T\313\245\"\210\340\316!\207" [m x j i intangible opoint buffer-disable-undo t 1 nil zerop 2 erase-buffer newline 0 insert-char 9 32 put-text-property 3 append-to-buffer 61 add-text-properties (mouse-face highlight help-echo "mouse-1: get robot moving, mouse-2: play on this square") 10 46 point-entered #[(x x) "o\205 \300u\207" [nil] 1] #[(x x) "m\205 \300u\207" [-1] 1] category lm-mode lm-goto-xy sit-for point inhibit-read-only lm-x-offset lm-square-width tab-width lm-y-offset n lm-square-height] 8 (#$ . 19738)])
#@72 Obnoxiously display some statistics about previous games in mode line.
(defalias 'lm-display-statistics #[nil "\303\304\305!\203 \306\202 	\245#\307 \207" [lm-number-of-trials lm-sum-of-moves mode-line-process format ": Trials: %d, Avg#Moves: %d" zerop 0 force-mode-line-update] 5 (#$ . 20880)])
#@47 Find or create the Lm buffer, and display it.
(defalias 'lm-switch-to-window #[nil "\302\303!\211\203 \304!\202 	\203 \305 \210\304\303!\210\306 )\207" [buff lm-game-in-progress get-buffer "*Lm*" switch-to-buffer lm-crash-game lm-mode] 3 (#$ . 21188) nil])
#@60 Return t if SQUARE belongs to a qtuple filled with VALUEs.
(defalias 'lm-find-filled-qtuple #[(square value) "\302	\303\304$\206! \302	\304\303$\206! \302	\303\211$\206! \302	\305\303$\207" [square value lm-check-filled-qtuple 1 0 -1] 5 (#$ . 21456)])
#@73 Return t if SQUARE belongs to a qtuple filled with VALUEs along DX, DY.
(defalias 'lm-check-filled-qtuple #[(square value dx dy) "\306\211\211\307	\n\"\f\211\310V\203, Z\211HU\203, S\211\202 \f\311\\W\203M \f\\\211HU\203M \fT\211\f\202. \f\311\\U\205i \312_\\\f_\\	\n$\210\313-\207" [square dx dy depl right left 0 lm-xy-to-index -4 4 lm-cross-qtuple t b a value lm-board] 8 (#$ . 21718)])
#@73 Cross every square between SQUARE1 and SQUARE2 in the DX, DY direction.
(defalias 'lm-cross-qtuple #[(square1 square2 dx dy) "\212\306	\"\307\211U\204\220 \310!\210\f\\	\311U\2035 \312u\210\313\314S\307#\210`\315\316w\210`|\210\202\n \311U\203` \312iW\203\\ T\312y\210j\210\317\320!\210\202A *\202\n \321U\203{ i\322\245Z\322\245y\210j\210\317\323!\210\202\n i\322\245\\\322\245y\210j\210\317\324!\210\202\n ,\325\311!\207" [dx dy inhibit-point-motion-hooks inhibit-read-only depl square1 lm-xy-to-index t lm-goto-square 0 1 insert-char 45 " 	" nil insert-and-inherit 124 -1 2 47 92 sit-for square2 lm-square-width column lm-n lm-square-height] 4 (#$ . 22154)])
#@42 Move point down one row on the Lm board.
(defalias 'lm-move-down #[nil "\301 W\205\n \302\303!\207" [lm-board-height lm-point-y next-line 1] 2 (#$ . 22858) nil])
#@40 Move point up one row on the Lm board.
(defalias 'lm-move-up #[nil "\301 \302V\205\n \303!\207" [lm-square-height lm-point-y 1 previous-line] 2 (#$ . 23027) nil])
#@40 Move point North East on the Lm board.
(defalias 'lm-move-ne #[nil "\300 \210\301u\207" [lm-move-up nil] 1 (#$ . 23197) nil])
#@40 Move point South East on the Lm board.
(defalias 'lm-move-se #[nil "\300 \210\301u\207" [lm-move-down nil] 1 (#$ . 23329) nil])
#@40 Move point North West on the Lm board.
(defalias 'lm-move-nw #[nil "\300 \210\301u\207" [lm-move-up -1] 1 (#$ . 23463) nil])
#@40 Move point South West on the Lm board.
(defalias 'lm-move-sw #[nil "\300 \210\301u\207" [lm-move-down -1] 1 (#$ . 23594) nil])
#@49 Move point to first square on the Lm board row.
(defalias 'lm-beginning-of-line #[nil "\301!\207" [lm-x-offset move-to-column] 2 (#$ . 23727) nil])
#@48 Move point to last square on the Lm board row.
(defalias 'lm-end-of-line #[nil "\303	\nS_\\!\207" [lm-x-offset lm-square-width lm-board-width move-to-column] 4 (#$ . 23882) nil])
#@146 Not used.
Affects a noise generator which was used in an earlier incarnation of
this program to add a random element to the way moves were made.
(defvar lm-nvar 0.0075 (#$ . 24069))
#@65 Used when doing something relative to the north and south axes.
(defvar lm-ns '(lm-n lm-s) (#$ . 24257))
#@63 Used when doing something relative to the east and west axes.
(defvar lm-ew '(lm-e lm-w) (#$ . 24368))
#@26 The cardinal directions.
(defvar lm-directions '(lm-n lm-s lm-e lm-w) (#$ . 24477))
#@33 The full 8 possible directions.
(defvar lm-8-directions '((lm-n) (lm-n lm-w) (lm-w) (lm-s lm-w) (lm-s) (lm-s lm-e) (lm-e) (lm-n lm-e)) (#$ . 24567))
(byte-code "\301B\302\301!\204\f \303\301\207" [current-load-list lm-number-of-moves boundp "The number of moves made by the robot so far."] 2)
#@35 If non-nil, debugging is printed.
(defvar lm-debug nil (#$ . 24869))
#@191 If non-nil, print "One moment please" when a new board is generated.
The drawback of this is you don't see how many moves the last run took
because it is overwritten by "One moment please".
(custom-declare-variable 'lm-one-moment-please 'nil '(#$ . 24945) :type 'boolean :group 'lm)
#@68 If non-nil, output number of moves so far on a move-by-move basis.
(custom-declare-variable 'lm-output-moves 't '(#$ . 25234) :type 'boolean :group 'lm)
(defalias 'lm-weights-debug #[nil "\205 \301 \210\302 \210\303 \210\304 \207" [lm-debug lm-print-wts lm-blackbox lm-print-y\,s\,noise lm-print-smell] 1])
(defalias 'lm-print-distance-int #[(direction) "\301\302\211\303N#c\207" [direction format "%S %S " distance] 5 nil nil])
(defalias 'lm-print-distance #[nil "\301\302\303\304!\"c\210\305\306\"\207" [lm-directions format "tree: %S \n" calc-distance-of-robot-from lm-tree mapc lm-print-distance-int] 4])
(defalias 'lm-nslify-wts-int #[(direction) "\301\302\"\207" [lm-directions mapcar #[(target-direction) "	N\207" [direction target-direction] 2]] 3])
(defalias 'lm-nslify-wts #[nil "\302\303\304\305\"\"\306\307	\"c\210\306\310\311\312	B!\311\313	B!#c)\207" [lm-directions l apply append mapcar lm-nslify-wts-int format "set data_value WTS \n %s \n" "/* max: %S min: %S */" eval max min] 6 nil nil])
(defalias 'lm-print-wts-int #[(direction) "\301\302\"\210\303c\207" [lm-directions mapc #[(target-direction) "\302\303		N$c\207" [direction target-direction format "%S %S %S "] 6] "\n"] 3])
(defalias 'lm-print-wts #[nil "\212\301q\210\302c\210\303\304\")\207" [lm-directions "*lm-wts*" "==============================\n" mapc lm-print-wts-int] 3 nil nil])
(defalias 'lm-print-moves #[(moves) "\212\301q\210\302\303\"c)\207" [moves "*lm-moves*" format "%S\n"] 3 nil nil])
(defalias 'lm-print-y\,s\,noise-int #[(direction) "\301\302\303!\304N\305N\306N%c\207" [direction format "%S:lm-y %S, s %S, noise %S \n" symbol-name y_t s noise] 7])
(defalias 'lm-print-y\,s\,noise #[nil "\212\301q\210\302c\210\303\304\")\207" [lm-directions "*lm-y,s,noise*" "==============================\n" mapc lm-print-y\,s\,noise-int] 3 nil nil])
(defalias 'lm-print-smell-int #[(direction) "\301\302\303!\304N#c\207" [direction format "%S: smell: %S \n" symbol-name smell] 5])
(defalias 'lm-print-smell #[nil "\212\301q\210\302c\210\303\304\305\306N\"c\210\307\310\")\207" [lm-directions "*lm-smell*" "==============================\n" format "tree: %S \n" z t mapc lm-print-smell-int] 4 nil nil])
(defalias 'lm-print-w0-int #[(direction) "\301\302\303!\304N#c\207" [direction format "%S: w0: %S \n" symbol-name w0] 5])
(defalias 'lm-print-w0 #[nil "\212\301q\210\302c\210\303\304\")\207" [lm-directions "*lm-w0*" "==============================\n" mapc lm-print-w0-int] 3 nil nil])
(defalias 'lm-blackbox #[nil "\212\301q\210\302c\210\303c\210\304\305\"\210\306c\210\307c\210\304\310\"\210\306c\210\311 \210\312\313\314\315N\314\316NZ\"c\210\317 \210\306c)\207" [lm-directions "*lm-blackbox*" "==============================\n" "I smell: " mapc #[(direction) "\301N\302V\205 \303\304\"c\207" [direction smell 0 format "%S "] 3] "\n" "I move: " #[(direction) "\301N\302V\205 \303\304\"c\207" [direction y_t 0 format "%S "] 3] lm-print-wts-blackbox format "z_t-z_t-1: %S" z t t-1 lm-print-distance] 5])
(defalias 'lm-print-wts-blackbox #[nil "\301\302\"\207" [lm-directions mapc lm-print-wts-int] 3 nil nil])
#@30 The maximum that w0j may be.
(custom-declare-variable 'lm-bound '0.005 '(#$ . 28367) :type 'number :group 'lm)
#@98 A factor applied to modulate the increase in wij.
Used in the function lm-update-normal-weights.
(custom-declare-variable 'lm-c '1.0 '(#$ . 28484) :type 'number :group 'lm)
#@98 A factor applied to modulate the increase in w0j.
Used in the function lm-update-naught-weights.
(custom-declare-variable 'lm-c-naught '0.5 '(#$ . 28663) :type 'number :group 'lm)
(byte-code "\301B\303\301!\204\f \304\302B\303\302!\204 \305\301\207" [current-load-list lm-initial-w0 lm-initial-wij boundp 0.0 0.0] 2)
#@136 The amount of simulation cycles that have occurred with no movement.
Used to move the robot when he is stuck in a rut for some reason.
(custom-declare-variable 'lm-no-payoff '0 '(#$ . 28994) :type 'integer :group 'lm)
#@151 The maximum number of cycles that the robot can remain stuck in a place.
After this limit is reached, lm-random-move is called to push him out of it.
(custom-declare-variable 'lm-max-stall-time '2 '(#$ . 29219) :type 'integer :group 'lm)
(defalias 'lm-flip-a-coin #[nil "\300\301!\302V\203\n \303\207\304\207" [random 5000 2500 -1 1] 2])
(defalias 'lm-randomize-weights-for #[(direction) "\301\302\"\207" [lm-directions mapc #[(target-direction) "\302	\303 \304\305!\306\245_#\207" [direction target-direction put lm-flip-a-coin random 10000 10000.0] 6]] 3])
(defalias 'lm-noise #[nil "\301\302!\303\245S_\207" [lm-nvar random 30001 15000.0] 2])
(defalias 'lm-fix-weights-for #[(direction) "\301\302\"\207" [lm-directions mapc #[(target-direction) "\303	\n#\207" [direction target-direction lm-initial-wij put] 4]] 3])
(defalias 'lm-plot-internal #[(sym) "\301\302\303N\304N\"\300N\"\207" [sym lm-plot-square lm-xy-to-index x y] 5])
(defalias 'lm-plot-landmarks #[nil "\304\245\n\304\245\305\306\307	#\210\305\306\310\311#\210\305\306\312\304#\210\305\313\307	#\210\305\313\310#\210\305\313\312\314#\210\305\315\307	#\210\305\315\310\n#\210\305\315\312\316#\210\305\317\307\311#\210\305\317\310\n\304\245#\210\305\317\312\320#\210\305\321\307#\210\305\321\310\n\304\245#\210\305\321\312\322#\210\323\324\325\"\207" [lm-board-width lm-cx lm-board-height lm-cy 2 put lm-n x y 1 sym lm-tree 6 lm-s 3 lm-w 5 lm-e 4 mapc lm-plot-internal (lm-n lm-s lm-e lm-w lm-tree)] 5])
(defalias 'square #[(a) "\211_\207" [a] 2])
(defalias 'distance #[(x x0 y y0) "\304\305	Z!\305\nZ!\\!\207" [x x0 y y0 sqrt square] 5])
(defalias 'calc-distance-of-robot-from #[(direction) "\301\302\211\303N\304\305 !\306N\307\305 !$#\207" [direction put distance x lm-index-to-x lm-point-square y lm-index-to-y] 9])
(defalias 'calc-smell-internal #[(sym) "\302N\303!\304\305	\n\245Z_\306V\203 \307\305	\n\245Z_\202 \306*\207" [sym d r calc-distance-of-robot-from 0.5 1 0 0.5] 4])
(defalias 'lm-f #[(x) "	V\203 	\207\302W\203 \303\207\207" [x lm-bound 0.0 0.0] 2])
(defalias 'lm-y #[(direction) "\302\301\303 #\302\304\305N\306V\203 \307\202 \310#)\207" [direction noise put lm-noise y_t s 0.0 1.0 0.0] 5])
(defalias 'lm-update-normal-weights #[(direction) "\301\302\"\207" [lm-directions mapc #[(target-direction) "\303		N\n\304\305N\304\306NZ_	\307N_\310N_\\#\207" [direction target-direction lm-c put z t t-1 y_t smell] 8]] 3])
(defalias 'lm-update-naught-weights #[(direction) "\301\302\"\207" [lm-directions mapc #[(target-direction) "\302\303\304\303N	\305\306N\305\307NZ_\310N_\\!#\207" [direction lm-c-naught put w0 lm-f z t t-1 y_t] 9]] 3])
(defalias 'lm-calc-current-smells #[nil "\301\302\"\207" [lm-directions mapc #[(direction) "\301\302\303!#\207" [direction put smell calc-smell-internal] 5]] 3])
(defalias 'lm-calc-payoff #[nil "\301\302\303\302\304N#\210\301\302\304\305\306!#\210\302\304N\302\303NZ\307U\203! T\211\207\310\211\207" [lm-no-payoff put z t-1 t calc-smell-internal lm-tree 0.0 0] 5])
(defalias 'lm-store-old-y_t #[nil "\301\302\"\207" [lm-directions mapc #[(direction) "\301\302\303N#\207" [direction put y_t-1 y_t] 5]] 3])
(defalias 'lm-confidence-for #[(target-direction) "\302\303\304N\305\306	\"#\207" [target-direction lm-directions apply + w0 mapcar #[(direction) "	N\302N_\207" [direction target-direction smell] 3]] 6])
(defalias 'lm-calc-confidences #[nil "\301\302\"\207" [lm-directions mapc #[(direction) "\301\302\303!#\207" [direction put s lm-confidence-for] 5]] 3])
(defalias 'lm-move #[nil "\305\306N\307U\203 \310\306N\311U\203 \312\313\"\210	\203 \314\315!\210\316\306N\317U\203: \320\306N\321U\203: \312\322\n\"\210	\203: \314\323!\210\312\324\325\"\210\326\327 \330\"\210T\f\205R \314\331\332\"!\207" [lm-ns lm-debug lm-ew lm-number-of-moves lm-output-moves lm-n y_t 1.0 lm-s 1.0 mapc #[(dir) "\301\302\303#\207" [dir put y_t 0] 4] message "n-s normalization." lm-w 1.0 lm-e 1.0 #[(dir) "\301\302\303#\207" [dir put y_t 0] 4] "e-w normalization" #[(pair) "@\301N\302V\205 A@ \207" [pair y_t 0] 2] ((lm-n lm-move-up) (lm-s lm-move-down) (lm-e forward-char) (lm-w backward-char)) lm-plot-square lm-point-square 1 format "Moves made: %d"] 4])
(defalias 'lm-random-move #[nil "\304\305\"\210\306\307!	8\310\211\203! @\311\n\312\313#\210A\211\204 *\314 \207" [lm-directions lm-8-directions direction #1=#:--dolist-temp--97269 mapc #[(direction) "\301\302\303#\207" [direction put y_t 0] 4] random 8 nil put y_t 1.0 lm-move] 5])
(defalias 'lm-amble-robot #[nil "\304\305!\306V\203< \307 \210\310 \210	V\203 \311 \210\202% \312 \210\313\314\n\"\210\315 \210\316 \210\313\317\n\"\210\313\320\n\"\210\203  \321 \210\202  \322\323!\207" [lm-no-payoff lm-max-stall-time lm-directions lm-debug calc-distance-of-robot-from lm-tree 0 lm-store-old-y_t lm-calc-current-smells lm-random-move lm-calc-confidences mapc lm-y lm-move lm-calc-payoff lm-update-normal-weights lm-update-naught-weights lm-weights-debug lm-terminate-game nil] 3 nil nil])
#@180 Signal to the Lm program that you have played.
You must have put the cursor on the square where you want to play.
If the game is finished, this command requests for another game.
(defalias 'lm-start-robot #[nil "\306 \210\203\n \307 \207	\204 \310 \207\311\211\312 \211\204\" \313\314!\202U \315\fH!\2040 \313\316!\202U \317\320\"\210\321 \210\322 \210\323\324\325\326\327!#\210\330 \210\331 \210\332\333\"\210\332\334\"\210\335 *\207" [lm-emacs-is-computing lm-game-in-progress score square lm-board lm-directions lm-switch-to-window lm-crash-game lm-prompt-for-other-game nil lm-point-square error "Your point is not on a square. Retry !" zerop "Your point is not on a free square. Retry !" lm-plot-square 1 lm-store-old-y_t lm-calc-current-smells put z t calc-smell-internal lm-tree lm-random-move lm-calc-payoff mapc lm-update-normal-weights lm-update-naught-weights lm-amble-robot] 6 (#$ . 34257) nil])
(byte-code "\301B\302\301!\204\f \303\301\207" [current-load-list lm-tree-r boundp ""] 2)
(defalias 'lm-init #[(auto-start save-weights) "\306\307 \210	\203@ \212\310\311!q\210\312 \210\310\313!q\210\310\314!q\210\312 \210\310\315!q\210\312 \210\310\316!q\210\312 \210\310\317!q\210\312 \210\310\320!q\210\312 \210)\321 \210\322\323\n\"\210\204Y \322\324\n\"\210\322\325\n\"\210\202] \326\327!\210\f\205o \330\331!T\331!T\"\210\332 \207" [lm-number-of-moves lm-debug lm-directions save-weights auto-start lm-board-width 0 lm-plot-landmarks get-buffer-create "*lm-w0*" erase-buffer "*lm-moves*" "*lm-wts*" "*lm-y,s,noise*" "*lm-smell*" "*lm-blackbox*" "*lm-distance*" lm-set-landmark-signal-strengths mapc #[(direction) "\301\302\303#\207" [direction put y_t 0.0] 4] lm-fix-weights-for #[(direction) "\302\303	#\207" [direction lm-initial-w0 put w0] 4] message "Weights preserved for this run." lm-goto-xy random lm-start-robot lm-board-height] 4])
(defalias 'lm-set-landmark-signal-strengths #[nil "\305\306!\306	!\\!\307_\310\311\"\210\310\312\f\"\210\313\314\315\n#\207" [lm-cx lm-cy lm-tree-r lm-ew lm-ns sqrt square 1.5 mapc #[(direction) "\302\303	\304_#\207" [direction lm-cx put r 1.1] 5] #[(direction) "\302\303	\304_#\207" [direction lm-cy put r 1.1] 5] put lm-tree r] 4])
(defalias 'landmark-repeat 'lm-test-run)
#@72 Run 100 Lm games, each time saving the weights from the previous game.
(defalias 'lm-test-run #[nil "\302\303!\210\304\305	W\203 \302\306!\210T\211\202	 *\307\207" [scratch-var #1=#:--dotimes-temp--97270 lm 1 100 0 2 nil] 3 (#$ . 36518) nil])
(defalias 'landmark 'lm)
#@614 Start or resume an Lm game.
If a game is in progress, this command allows you to resume it.
Here is the relation between prefix args and game options:

prefix arg | robot is auto-started | weights are saved from last game
---------------------------------------------------------------------
none / 1   | yes                   | no
       2   | yes                   | yes
       3   | no                    | yes
       4   | no                    | no

You start by moving to a square and typing \[lm-start-robot],
if you did not use a prefix arg to ask for automatic start.
Use \[describe-mode] for more info.
(defalias 'lm #[(parg) "\306\306\307 \210\n\203 \310 \207\203 \f\311X\205\252 \312 \313  \204&  	\204, \314W\2039 \315\316!\210\202R 	\314W\203F \315\317!\210\202R  V\203R \315\320\"\210	V\203j 	!=\204j \321\322\323	\"!\204j *\"\203t \324\325!\210\326	\"\210\327\330#\314U\203\206 \331\202\250 #\311U\203\221 \332\202\250 #\333U\203\234 \334\202\250 #\335U\203\247 \336\202\250 \337B!\207" [lm-n lm-m lm-emacs-is-computing lm-game-in-progress lm-number-of-moves max-height nil lm-switch-to-window lm-crash-game 2 lm-max-width lm-max-height 1 error "I need at least 1 column" "I need at least 1 row" "I cannot display %d columns in that window" y-or-n-p format "Do you really want %d rows " message "One moment, please..." lm-start-game eval lm-init (t nil) (t t) 3 (nil t) 4 (nil nil) (nil t) max-width lm-saved-board-height lm-one-moment-please parg] 4 (#$ . 36799) "p"])
(provide 'landmark)
