;ELC   
;;; Compiled by buildd@akateko.buildd on Fri Oct 25 13:52:34 2013
;;; from file /build/buildd/emacs23-23.4+1/debian/build-x/lisp/play/mpuz.el
;;; in Emacs version 23.4.1
;;; with all optimizations.

;;; This file uses dynamic docstrings, first added in Emacs 19.29.

;;; This file does not contain utf-8 non-ASCII characters,
;;; and so can be loaded in Emacs versions earlier than 23.

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


(byte-code "\300\301\302\303\304\305\306\307&\210\310\311!\207" [custom-declare-group mpuz nil "Multiplication puzzle." :prefix "mpuz-" :group games random t] 8)
#@120 Set this to nil if you want dings on inputs.
The value t means never ding, and `error' means only ding on wrong input.
(custom-declare-variable 'mpuz-silent ''error '(#$ . 703) :type '(choice (const :tag "No" nil) (const :tag "Yes" t) (const :tag "If correct" error)) :group 'mpuz)
#@72 Solve any row that can be trivially calculated from what you've found.
(custom-declare-variable 'mpuz-solve-when-trivial 't '(#$ . 991) :type 'boolean :group 'mpuz)
#@34 Allow 2nd factors like 33 or 77.
(custom-declare-variable 'mpuz-allow-double-multiplicator 'nil '(#$ . 1162) :type 'boolean :group 'mpuz)
(byte-code "\300\301\302\303\304\305%\210\300\306\307\310\304\305%\210\300\311\312\313\304\305%\210\300\314\315\316\304\305%\207" [custom-declare-face mpuz-unsolved ((((class color)) (:foreground "red1" :bold t)) (t (:bold t))) "Face to use for letters to be solved." :group mpuz mpuz-solved ((((class color)) (:foreground "green1" :bold t)) (t (:bold t))) "Face to use for solved digits." mpuz-trivial ((((class color)) (:foreground "blue" :bold t)) (t (:bold t))) "Face to use for trivial digits solved for you." mpuz-text ((t (:inherit variable-pitch))) "Face to use for text on right."] 6)
#@33 Hook to run upon entry to mpuz.
(custom-declare-variable 'mpuz-mode-hook 'nil '(#$ . 1900) :type 'hook :group 'mpuz)
#@37 Local keymap to use in Mult Puzzle.
(defvar mpuz-mode-map (byte-code "\301 \302\303\304\"\210\305\306\307#\210\305\310\311#\210)\207" [map make-sparse-keymap mapc #[(ch) "\302\303	!\304#\207" [map ch define-key char-to-string mpuz-try-letter] 4] "abcdefghijABCDEFGHIJ" define-key "" mpuz-offer-abort "?" describe-mode] 4) (#$ . 2023))
#@456 Multiplication puzzle mode.

You have to guess which letters stand for which digits in the
multiplication displayed inside the `*Mult Puzzle*' buffer.

You may enter a guess for a letter's value by typing first the letter,
then the digit.  Thus, to guess that A=3, type `A 3'.

To leave the game to do other editing work, just switch buffers.
Then you may resume the game with M-x mpuz.
You may abort a game by typing \<mpuz-mode-map>\[mpuz-offer-abort].
(defalias 'mpuz-mode #[nil "\304 \210\305\306\307\310!\210\311\312!\207" [major-mode mode-name tab-width mpuz-mode-map kill-all-local-variables mpuz-mode "Mult Puzzle" 30 use-local-map run-mode-hooks mpuz-mode-hook] 2 (#$ . 2371) nil])
#@40 Number of errors made in current game.
(defvar mpuz-nb-errors 0 (#$ . 3072))
#@28 Number of games completed.
(defvar mpuz-nb-completed-games 0 (#$ . 3155))
#@42 Number of errors made in previous games.
(defvar mpuz-nb-cumulated-errors 0 (#$ . 3235))
#@42 True if a game is currently in progress.
(defvar mpuz-in-progress nil (#$ . 3330))
#@54 A vector recording which digits have been decrypted.
(defvar mpuz-found-digits (make-bool-vector 10 nil) (#$ . 3419))
#@59 A vector recording which digits have been solved for you.
(defvar mpuz-trivial-digits (make-bool-vector 10 nil) (#$ . 3543))
(defalias 'mpuz-digit-solved-p '(macro . #[(digit) "\301\302\303E\302\304EE\207" [digit or aref mpuz-found-digits mpuz-trivial-digits] 5]))
#@38 A permutation from [0..9] to [0..9].
(defvar mpuz-digit-to-letter (make-vector 10 0) (#$ . 3816))
#@40 The inverse of `mpuz-digit-to-letter'.
(defvar mpuz-letter-to-digit (make-vector 10 0) (#$ . 3920))
(defalias 'mpuz-to-digit '(macro . #[(letter) "\301\302E\207" [letter aref mpuz-letter-to-digit] 3]))
(defalias 'mpuz-to-letter '(macro . #[(digit) "\301\302E\207" [digit aref mpuz-digit-to-letter] 3]))
#@53 Initialize puzzle coding with a random permutation.
(defalias 'mpuz-build-random-perm #[nil "\305\306\307\310\311\312\313\314\315\316\257\n\317\320\n\2050 \321	!\n8\322\n\"	S	I\210\f	I\210\202 +\207" [elem index letters mpuz-digit-to-letter mpuz-letter-to-digit 0 1 2 3 4 5 6 7 8 9 10 nil random delq] 10 (#$ . 4231)])
#@73 The board associates to any digit the list of squares where it appears.
(defvar mpuz-board (make-vector 10 nil) (#$ . 4567))
#@68 Put (last digit of) NUMBER on ROW and COLUMNS of the puzzle board.
(defalias 'mpuz-put-number-on-board #[(number row &rest columns) "\306	\306\211\205) @\f\307\246\f\307\245\nBHBI\210A\211\204\n \306+\207" [digit columns column --dolist-tail-- number mpuz-board nil 10 row] 6 (#$ . 4698)])
#@62 Check whether all digits have been solved.  Return t if yes.
(defalias 'mpuz-check-all-solved #[(&optional row col) "\300\301\215\207" [solved (byte-code "\306\211\211\211\211\211\211\203\370 \204\370 \206! \307\310\311\"\f\206* \307\310\312\"	\2062 \307\313!\206; \307\314!\211\203I \203I \f\204Z 	\203g \204Z \203g \f\203g \315 \210\316 \210\317\320\321\"\202\365 \n\206n \307\322!\206v \307\323!\211\203\211 \n\203\211 	\204\211 \315\313!\202\365 	\203\241 \n=\204\241 \315\n\203\234 \323\202\235 \322!\202\365 \203\277 \f=\204\277 \315\203\265 \310\202\266 \323\205\273 \312\"\202\365 \203\335 \n=\204\335 \315\n\203\323 \310\202\324 \322\n\205\331 \311\"\202\365 \204\370 \f\203\352 \204\362 \203\370 \n\203\370 \315\314!\204 \316 \210\324\325\326\"\210.\321\207" [squares E D C B2 B1 nil mpuz-check-all-solved 4 7 9 10 2 mpuz-solve mpuz-paint-board throw solved t 8 6 mapc #[(digit) "	H\206	 \n	H?\2055 	H\211\2055 \203- 	\203' 	B\f\235\202. \f\236\202. \f\2055 \306\307\310\"\207" [mpuz-found-digits digit mpuz-trivial-digits mpuz-board squares row throw solved nil col] 3] [0 1 2 3 4 5 6 7 8 9] A mpuz-solve-when-trivial row] 7)] 2 (#$ . 5009)])
#@50 Draw random values to be multiplied in a puzzle.
(defalias 'mpuz-random-puzzle #[nil "\306 \210\307\310\"\210	\203 \311\312\313!\\\202 \314\312\315!\\\316\n\245T\211\312\317Z!\\\310\211\310\211\f\312\317Z!\\\211U\203D 	\2032 \n_\n\f_\317_\\\320\n\321\322\323\324%\210\320\f\317_\\\325\322\323$\210\320\326\322\323\324\327&\210\320\330\323\324\327\331&\210\320\317\322\323\324\327\331&.\207" [mpuz-board mpuz-allow-double-multiplicator A min B1 B2 mpuz-build-random-perm fillarray nil 112 random 888 125 875 999 10 mpuz-put-number-on-board 2 9 7 5 4 6 3 8 1 C D E] 9 (#$ . 6219)])
#@56 The general picture of the puzzle screen, as a string.
(defconst mpuz-framework "\n     . . .\n	Number of errors (this game):	0\n    x  . .\n   -------\n   . . . .\n	Number of completed games:	0\n . . . .\n ---------	Average number of errors:	0.00\n . . . . ." (#$ . 6844))
#@53 Create (or recreate) the puzzle buffer.  Return it.
(defalias 'mpuz-create-buffer #[nil "\304\305!\306\307r\nq\210\310 \210c\210\311\312\313	#\210\311\314\315	#\210\311\316\317	#\210\320 \210\321 \210\322 \210)\n+\207" [buffer-read-only face buf mpuz-framework get-buffer-create "*Mult Puzzle*" (face mpuz-text) nil erase-buffer set-text-properties 13 42 79 105 128 153 mpuz-paint-board mpuz-paint-errors mpuz-paint-statistics] 4 (#$ . 7124)])
(defalias 'mpuz-paint-number #[(n &optional eol words) "\210\304`\n\206 \305[v\210`|\210c)\207" [eol buffer-read-only words n nil 1] 2])
#@41 Paint error count on the puzzle screen.
(defalias 'mpuz-paint-errors #[nil "\301 \210eb\210\302y\210\303\304!!\207" [mpuz-nb-errors mpuz-switch-to-window 2 mpuz-paint-number prin1-to-string] 3 (#$ . 7720)])
#@61 Paint statistics about previous games on the puzzle screen.
(defalias 'mpuz-paint-statistics #[nil "eb\210\302y\210\303\304!!\210\303\305\306\307!\203 \310\202 \311	\\\245\"\312\313#\207" [mpuz-nb-completed-games mpuz-nb-cumulated-errors 6 mpuz-paint-number prin1-to-string format "%.2f" zerop 0 0.0 3 2] 5 (#$ . 7934)])
#@45 Paint board situation on the puzzle screen.
(defalias 'mpuz-paint-board #[nil "\300 \210\301\302\303\"\210eb\207" [mpuz-switch-to-window mapc mpuz-paint-digit [0 1 2 3 4 5 6 7 8 9]] 3 (#$ . 8266)])
#@53 Paint all occurrences of DIGIT on the puzzle board.
(defalias 'mpuz-paint-digit #[(digit) "	H\204\f \n	H\203 	\306\\\202 	H\307\\\305\n	H\203\" \310\202- 	H\203, \311\202- \312D\313\314\315	H\"+\207" [mpuz-found-digits digit mpuz-trivial-digits mpuz-digit-to-letter buffer-read-only face 48 65 mpuz-trivial mpuz-solved mpuz-unsolved nil mapc #[(square) "eb\210@Sy\210\303A!\210	c\210\304`S`\n#\210\305\306!\207" [square char face move-to-column set-text-properties delete-char 1] 4] char mpuz-board] 4 (#$ . 8470)])
#@37 Get the puzzle buffer if it exists.
(defalias 'mpuz-get-buffer #[nil "\300\301!\207" [get-buffer "*Mult Puzzle*"] 2 (#$ . 9005)])
#@56 Find or create the Mult-Puzzle buffer, and display it.
(defalias 'mpuz-switch-to-window #[nil "\302 \211\204\n \303 \304!\210\305\306 )\207" [buf buffer-read-only mpuz-get-buffer mpuz-create-buffer switch-to-buffer t mpuz-mode] 3 (#$ . 9141)])
#@21 Start a new puzzle.
(defalias 'mpuz-start-new-game #[nil "\304\305!\210\306\307\310\n\311\"\210\310\311\"\210\312 \210\313 \210\314 \210\315 \210\316 \207" [mpuz-nb-errors mpuz-in-progress mpuz-found-digits mpuz-trivial-digits message "Here we go..." 0 t fillarray nil mpuz-random-puzzle mpuz-switch-to-window mpuz-paint-board mpuz-paint-errors mpuz-ask-for-try] 3 (#$ . 9395)])
#@39 Multiplication puzzle with GNU Emacs.
(defalias 'mpuz #[nil "\301 \210\203\n \302 \207\303 \207" [mpuz-in-progress mpuz-switch-to-window mpuz-offer-abort mpuz-start-new-game] 1 (#$ . 9783) nil])
#@44 Ask if user wants to abort current puzzle.
(defalias 'mpuz-offer-abort #[nil "\304\305!\203 \306 \307\310!\210\311\312\313\311\"\210\205 \314!)\207\315 \207" [buf mpuz-in-progress mpuz-nb-errors mpuz-board y-or-n-p "Abort game? " mpuz-get-buffer message "Mult Puzzle aborted." nil 0 fillarray kill-buffer mpuz-ask-for-try] 3 (#$ . 9985) nil])
#@34 Ask for user proposal in puzzle.
(defalias 'mpuz-ask-for-try #[nil "\300\301!\207" [message "Your try?"] 2 (#$ . 10342)])
#@57 Dings, unless global variable `mpuz-silent' forbids it.
(defalias 'mpuz-ding #[(error) "\302=\206 \204 \303\302!\207	\205 \303\302!\207" [mpuz-silent error t ding] 2 (#$ . 10470)])
#@41 Propose a digit for a letter in puzzle.
(defalias 'mpuz-try-letter #[nil "\203p \306\211\211\211\226\f\307ZHH\204$ H\203/ \301\310\f\"\210\311\312!\202n H\204A \301\313\f\"\210\311\312!\202n \301\314\f\"\210\315 \211\316=\203R \315 \n\317V\204^ \n\320W\203j \301\321\f\n#\210\311\312!\202n \322\f\n\",\207\323\324!\203y \325 \207\301\326!\207" [mpuz-in-progress message digit-char digit letter-char last-command-event nil 65 "%c already solved." mpuz-ding t "%c does not appear." "%c = " read-char 61 57 48 "%c = %c" mpuz-try-proposal y-or-n-p "Start a new game? " mpuz-start-new-game "OK. I won't." mpuz-letter-to-digit mpuz-found-digits mpuz-trivial-digits mpuz-board] 5 (#$ . 10662) nil])
#@45 Propose LETTER-CHAR as code for DIGIT-CHAR.
(defalias 'mpuz-try-proposal #[(letter-char digit-char) "\306Z\n\307Z\f	HH\204 H\203' \310\311\307\\\"\202m H\2045 H\203< \310\312\n\"\202m U\203\\ \310\313\n#\210\314\315!\210\316I\210\317 \205m \320 \202m \310\321\n#\210\314\316!\210T\322 ,\207" [letter-char letter digit-char digit mpuz-letter-to-digit correct-digit 65 48 message "%c has already been found." "%c has already been placed." "%c = %c correct!" mpuz-ding nil t mpuz-check-all-solved mpuz-close-game "%c = %c incorrect!" mpuz-paint-errors mpuz-nb-completed-games game mpuz-found-digits mpuz-trivial-digits mpuz-nb-errors] 4 (#$ . 11381)])
#@44 Housecleaning when puzzle has been solved.
(defalias 'mpuz-close-game #[nil "\305	\n\\T\306 \210\307\310\n\211\311U\203 \312\202 \313\n\314U\203$ \315\202a \n\311U\203. \316\202a \n\317U\2038 \320\202a \n\321U\203B \322\202a \n\323U\203L \324\202a \n\325W\203V \326\202a \n\327W\203` \330\202a \331$\304\332\f\"\210\333\323!\210\334\f\335P!\203y \336 \202| \304\337!)\207" [mpuz-in-progress mpuz-nb-cumulated-errors mpuz-nb-errors mpuz-nb-completed-games message nil mpuz-paint-statistics format "Puzzle solved with %d error%s. That's %s" 1 "" "s" 0 "perfect!" "very good!" 2 "good." 3 "not bad." 4 "not too bad..." 10 "bad!" 15 "awful." "not serious." "%s" sit-for y-or-n-p "  Start a new game? " mpuz-start-new-game "Good Bye!"] 6 (#$ . 12069)])
#@32 Find solution for autosolving.
(defalias 'mpuz-solve #[(&optional row col) "\300\301\302\"\210\303\207" [mapc #[(digit) "	H\206+ \n	H\206+ \203' \f\203 \fB	H\235\202# 	H\236?\206+ \n	\306I\207" [mpuz-found-digits digit mpuz-trivial-digits row col mpuz-board t] 3] [0 1 2 3 4 5 6 7 8 9] t] 3 (#$ . 12830)])
#@42 Display solution for debugging purposes.
(defalias 'mpuz-show-solution #[(row) "\301 \210\302\205 \303!\304_!\210\305 \210\306 \205 \307 \207" [row mpuz-switch-to-window mpuz-solve prefix-numeric-value 2 mpuz-paint-board mpuz-check-all-solved mpuz-close-game] 3 (#$ . 13149) "P"])
(provide 'mpuz)
