;ELC   
;;; Compiled
;;; in Emacs version 30.1
;;; with all optimizations.


#@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.#@2 #@72 Solve any row that can be trivially calculated from what you've found.#@34 Allow 2nd factors like 33 or 77.#@32 Face for letters to be solved.
(byte-code "\300\301\302\303\304\305\306\307&\210\310\311\312\313\314DD\315\316\317%\210\310\320\312\313\321DD\322\316\323%\210\310\324\312\313\325DD\326\316\323%\207" [custom-declare-group mpuz nil "Multiplication puzzle." :prefix "mpuz-" :group games custom-declare-variable mpuz-silent funcall function #[0 "\300\207" [error] 1 (#$ . 207)] (#$ . 84) :type (choice (const :tag "No" nil) (const :tag "Yes" t) (const :tag "If correct" error)) mpuz-solve-when-trivial #[0 "\300\207" [t] 1 (#$ . 207)] (#$ . 213) boolean mpuz-allow-double-multiplicator #[0 "\300\207" [nil] 1 (#$ . 207)] (#$ . 289)] 8)
(custom-declare-face 'mpuz-unsolved '((default :weight bold) (((class color)) :foreground "red1")) '(#$ . 327))#@25 Face for solved digits.
(custom-declare-face 'mpuz-solved '((default :weight bold) (((class color)) :foreground "green1")) '(#$ . 1077))#@41 Face for trivial digits solved for you.
(custom-declare-face 'mpuz-trivial '((default :weight bold) (((class color)) :foreground "blue")) '(#$ . 1219))#@25 Face for text on right.
(custom-declare-face 'mpuz-text '((t :inherit variable-pitch)) '(#$ . 1376))#@33 Hook to run upon entry to mpuz.#@37 Local keymap to use in Mult Puzzle.
(byte-code "\300\301\302\303\304DD\305\306\307%\207" [custom-declare-variable mpuz-mode-hook funcall function #[0 "\300\207" [nil] 1 (#$ . 207)] (#$ . 1482) :type hook] 6)
(defvar mpuz-mode-map (define-keymap "C-g" 'mpuz-offer-abort "?" 'describe-mode) (#$ . 1519))
(byte-code "\301\302\303\"\211\203 \211@\304\305#\266A\202 \207" [mpuz-mode-map mapcar char-to-string "abcdefghijABCDEFGHIJ" keymap-set mpuz-try-letter] 6)
(defvar mpuz-mode-hook nil)
(byte-code "\300\301N\204\f \302\300\301\303#\210\304\305!\204 \302\305\306\307#\210\300\207" [mpuz-mode-hook variable-documentation put "Hook run after entering `mpuz-mode'.\nNo problems result if this variable is not bound.\n`add-hook' automatically binds it.  (This is true for all hook variables.)" boundp mpuz-mode-map definition-name mpuz-mode] 4)
(defvar mpuz-mode-map (make-sparse-keymap))#@240 Major-mode.
Uses keymap `mpuz-mode-map', abbrev table `mpuz-mode-abbrev-table' and
syntax-table `mpuz-mode-syntax-table'.

This mode runs the hook `mpuz-mode-hook', as the final or penultimate
step during initialization.

\{mpuz-mode-map}
(byte-code "\301\302N\204 \303\301\302\304\305!#\210\306\307!\204* \303\307\310\311#\210\312\307\306\307!\203& \313\202( \314 \"\210\307\302N\2048 \303\307\302\304\315!#\210\306\300!\204X \303\300\310\311#\210\312\300\306\300!\203P \313\202V \316\300\313\"\210\"\210\300\302N\204f \303\300\302\304\317!#\210\320\321!\203t \321\311\313\"\210\202z \303\311\322\313#\210\313\207" [mpuz-mode-abbrev-table mpuz-mode-map variable-documentation put purecopy "Keymap for `mpuz-mode'." boundp mpuz-mode-syntax-table definition-name mpuz-mode defvar-1 nil make-syntax-table "Syntax table for `mpuz-mode'." define-abbrev-table "Abbrev table for `mpuz-mode'." fboundp derived-mode-set-parent derived-mode-parent] 5)
(defalias 'mpuz-mode #[0 "\306\300!\210\307\310 \210\311\312\313!\210\314\f!\210\315)\316\317!\207" [delay-mode-hooks major-mode mode-name mpuz-mode-map mpuz-mode-syntax-table mpuz-mode-abbrev-table make-local-variable t kill-all-local-variables mpuz-mode "Mult Puzzle" use-local-map set-syntax-table 30 run-mode-hooks mpuz-mode-hook local-abbrev-table tab-width] 2 (#$ . 2415)])#@40 Number of errors made in current game.
(defvar mpuz-nb-errors 0 (#$ . 3754))#@28 Number of games completed.
(defvar mpuz-nb-completed-games 0 (#$ . 3836))#@42 Number of errors made in previous games.
(defvar mpuz-nb-cumulated-errors 0 (#$ . 3915))#@45 Non-nil if a game is currently in progress.
(defvar mpuz-in-progress nil (#$ . 4009))#@54 A vector recording which digits have been decrypted.
(defvar mpuz-found-digits (make-bool-vector 10 nil) (#$ . 4100))#@59 A vector recording which digits have been solved for you.
(defvar mpuz-trivial-digits (make-bool-vector 10 nil) (#$ . 4223))#@14 

(fn DIGIT)
(defalias 'mpuz-digit-solved-p '(macro . #[257 "\300\301\302E\301\303EE\207" [or aref mpuz-found-digits mpuz-trivial-digits] 6 (#$ . 4353)]))#@38 A permutation from [0..9] to [0..9].
(defvar mpuz-digit-to-letter (make-vector 10 0) (#$ . 4515))#@40 The inverse of `mpuz-digit-to-letter'.
(defvar mpuz-letter-to-digit (make-vector 10 0) (#$ . 4618))#@15 

(fn LETTER)
(defalias 'mpuz-to-digit '(macro . #[257 "\300\301E\207" [aref mpuz-letter-to-digit] 4 (#$ . 4723)]))
(defalias 'mpuz-to-letter '(macro . #[257 "\300\301E\207" [aref mpuz-digit-to-letter] 4 (#$ . 4353)]))#@53 Initialize puzzle coding with a random permutation.
(defalias 'mpuz-build-random-perm #[0 "\302\303\304\305\306\307\310\311\312\313\257\n\314\315\205. \316!\262\317\"\262S\262I\210	I\210\202 \207" [mpuz-digit-to-letter mpuz-letter-to-digit 0 1 2 3 4 5 6 7 8 9 10 nil seq-random-elt delq] 10 (#$ . 4949)])#@73 The board associates to any digit the list of squares where it appears.
(defvar mpuz-board (make-vector 10 nil) (#$ . 5273))#@99 Put (last digit of) NUMBER on ROW and COLUMNS of the puzzle board.

(fn NUMBER ROW &rest COLUMNS)
(defalias 'mpuz-put-number-on-board #[642 "\301\211\205$ \211@\302\246\262\302\245\262BHBI\266A\202 \207" [mpuz-board nil 10] 11 (#$ . 5403)])#@86 Check whether all digits have been solved.  Return t if yes.

(fn &optional ROW COL)
(defalias 'mpuz-check-all-solved #[512 "\3012\302\211\211\211\211\211\211C\203\371 \204\371 \206 \303\304\305\"\262\206' \303\304\306\"\262\2060 \303\307!\262\206: \303\310!\211\262\203H \203H \204Y \203f \204Y \203f \203f \311 \210\312 \210\313\301\314\"\202\366 \206m \303\315!\262\206v \303\316!\211\262\203\212 \203\212 \204\212 \311\307!\202\366 \203\242 =\204\242 \311\203\235 \316\202\236 \315!\202\366 \203\300 =\204\300 \311\203\266 \304\202\267 \316\205\274 \306\"\202\366 \203\336 =\204\336 \311\203\324 \304\202\325 \315\205\332 \305\"\202\366 \204\371 \203\353 \204\363 \203\371 \203\371 \311\310!\204 \312 \210\317\320\321$\322\"\266\3140\207" [mpuz-solve-when-trivial solved nil mpuz-check-all-solved 4 7 9 10 2 mpuz-solve mpuz-paint-board throw t 8 6 mapc make-closure #[257 "H\206	 \fH?\2056 \300H\240\2056 \302\203- \301\203& \302\301B\300\242\235\202/ \302\300\242\236\202/ \300\242\2056 \306\307\310\"\207" [V0 V1 V2 mpuz-found-digits mpuz-trivial-digits mpuz-board throw solved nil] 4 (#$ . 4353)] [0 1 2 3 4 5 6 7 8 9]] 15 (#$ . 5664)])#@50 Draw random values to be multiplied in a puzzle.
(defalias 'mpuz-random-puzzle #[0 "\302 \210\303\304\"\210	\203 \305\306!\307\\\202 \305\310!\311\\\312\245T\211\305\313Z!\\\304\211\211\211\305\313	Z!\\\211\262U\203= 	\203( _\262_\262\313_\\\262\314\315\316\317\320%\210\314\313_\\\321\316\317$\210\314\322\316\317\320\323&\210\314\324\317\320\323\325&\210\314\313\316\317\320\323\325&\207" [mpuz-board mpuz-allow-double-multiplicator mpuz-build-random-perm fillarray nil random 888 112 875 125 999 10 mpuz-put-number-on-board 2 9 7 5 4 6 3 8 1] 15 (#$ . 6875)])#@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 . . . . ." (#$ . 7474))#@53 Create (or recreate) the puzzle buffer.  Return it.
(defalias 'mpuz-create-buffer #[0 "\302\303!\304r\211q\210\305 \210	c\210\306\307\310\311#\210\306\312\313\311#\210\306\314\315\311#\210\316 \210\317 \210\320 *\210\207" [buffer-read-only mpuz-framework get-buffer-create "*Mult Puzzle*" nil erase-buffer set-text-properties 13 42 (face mpuz-text) 79 105 128 153 mpuz-paint-board mpuz-paint-errors mpuz-paint-statistics] 5 (#$ . 7753)])#@30 

(fn N &optional EOL WORDS)
(defalias 'mpuz-paint-number #[769 "\210\301`\206 \302[v\210`|\210c)\207" [buffer-read-only nil 1] 5 (#$ . 8197)])#@41 Paint error count on the puzzle screen.
(defalias 'mpuz-paint-errors #[0 "\301 \210eb\210\302y\210\303\304!!\207" [mpuz-nb-errors mpuz-switch-to-window 2 mpuz-paint-number prin1-to-string] 3 (#$ . 8352)])#@61 Paint statistics about previous games on the puzzle screen.
(defalias 'mpuz-paint-statistics #[0 "eb\210\302y\210\303\304!!\210\303\305\306\307U\203 \307\202 	\310\\\245\"\311\312#\207" [mpuz-nb-completed-games mpuz-nb-cumulated-errors 6 mpuz-paint-number prin1-to-string format "%.2f" 0 0.0 3 2] 5 (#$ . 8563)])#@45 Paint board situation on the puzzle screen.
(defalias 'mpuz-paint-board #[0 "\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 (#$ . 8886)])#@65 Paint all occurrences of DIGIT on the puzzle board.

(fn DIGIT)#@15 

(fn SQUARE)
(defalias 'mpuz-paint-digit #[257 "H\204\f 	H\203 \211\305\\\202 \nH\306\\\307	H\203\" \310\202- H\203, \311\202- \312D\313\314\315\316#\fH\")\207" [mpuz-found-digits mpuz-trivial-digits mpuz-digit-to-letter buffer-read-only mpuz-board 48 65 face mpuz-trivial mpuz-solved mpuz-unsolved nil mapc make-closure #[257 "eb\210\211@Sy\210\302A!\210\301c\210\303`S`\300#\210\304\305!\207" [V0 V1 move-to-column set-text-properties delete-char 1] 5 (#$ . 9156)]] 8 (#$ . 9087)])#@37 Get the puzzle buffer if it exists.
(defalias 'mpuz-get-buffer #[0 "\300\301!\207" [get-buffer "*Mult Puzzle*"] 2 (#$ . 9660)])#@56 Find or create the Mult-Puzzle buffer, and display it.
(defalias 'mpuz-switch-to-window #[0 "\301 \206 \302 \303!\210\304\305 \207" [buffer-read-only mpuz-get-buffer mpuz-create-buffer switch-to-buffer t mpuz-mode] 3 (#$ . 9793)])#@21 Start a new puzzle.
(defalias 'mpuz-start-new-game #[0 "\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 (#$ . 10032)])#@39 Multiplication puzzle with GNU Emacs.
(defalias 'mpuz #[0 "\301 \210\203\n \302 \207\303 \207" [mpuz-in-progress mpuz-switch-to-window mpuz-offer-abort mpuz-start-new-game] 1 (#$ . 10418) nil])#@44 Ask if user wants to abort current puzzle.
(defalias 'mpuz-offer-abort #[0 "\303\304!\203 \305 \306\307!\210\310\311\312\n\310\"\210\211\205 \313!\207\314 \207" [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] 4 (#$ . 10618) [nil (mpuz-mode)]])#@34 Ask for user proposal in puzzle.
(defalias 'mpuz-ask-for-try #[0 "\300\301!\207" [message "Your try?"] 2 (#$ . 10985)])#@69 Dings, unless global variable `mpuz-silent' forbids it.

(fn ERROR)
(defalias 'mpuz-ding #[257 "\301=\206 \204 \302\301!\207\211\205 \302\301!\207" [mpuz-silent t ding] 3 (#$ . 11110)])#@41 Propose a digit for a letter in puzzle.
(defalias 'mpuz-try-letter #[0 "\203d \306\211\211	\226\262\n\307ZH\262H\204 \fH\203' \310\311\"\210\312\313!\207H\2046 \310\314\"\210\312\313!\207\310\315\"\210\316 \262\211\317=\203I \316 \262\211\320V\204U \211\321W\203_ \310\322#\210\312\313!\207\323\"\207\324\325!\203m \326 \207\310\327!\207" [mpuz-in-progress last-command-event mpuz-letter-to-digit mpuz-found-digits mpuz-trivial-digits mpuz-board nil 65 message "%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."] 7 (#$ . 11306) [nil (mpuz-mode)]])#@74 Propose LETTER-CHAR as code for DIGIT-CHAR.

(fn LETTER-CHAR DIGIT-CHAR)
(defalias 'mpuz-try-proposal #[514 "\304Z\305ZH	H\204 \nH\203 \306\307\305\\\"\207	H\204( \nH\203- \306\310\"\207U\203L \306\311#\210\312\313!\210	\314I\210\315 \205] \316 \207\306\317#\210\312\314!\210T\320 \207" [mpuz-letter-to-digit mpuz-found-digits mpuz-trivial-digits mpuz-nb-errors 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] 9 (#$ . 12002)])#@44 Housecleaning when puzzle has been solved.
(defalias 'mpuz-close-game #[0 "\304	\n\\T\305 \210\306\307\n\211\310U\203 \311\202 \312\n\313U\203$ \314\202a \n\310U\203. \315\202a \n\316U\2038 \317\202a \n\320U\203B \321\202a \n\322U\203L \323\202a \n\324W\203V \325\202a \n\326W\203` \327\202a \330$\331\332\"\210\333\322!\210\334\335P!\203v \336 \207\331\337!\207" [mpuz-in-progress mpuz-nb-cumulated-errors mpuz-nb-errors mpuz-nb-completed-games 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." message "%s" sit-for y-or-n-p "  Start a new game? " mpuz-start-new-game "Good Bye!"] 6 (#$ . 12597)])#@56 Find solution for autosolving.

(fn &optional ROW COL)
(defalias 'mpuz-solve #[512 "\300\301\302#\303\"\304\207" [mapc make-closure #[257 "\nH\206+ H\206+ \301\203' \300\203 \301\300B\fH\235\202# \301\fH\236?\206+ \305I\207" [V0 V1 mpuz-found-digits mpuz-trivial-digits mpuz-board t] 4 (#$ . 4353)] [0 1 2 3 4 5 6 7 8 9] t] 8 (#$ . 13349)])#@52 Display solution for debugging purposes.

(fn ROW)
(defalias 'mpuz-show-solution #[257 "\300 \210\301\205 \302!\303_!\210\304 \210\305 \205 \306 \207" [mpuz-switch-to-window mpuz-solve prefix-numeric-value 2 mpuz-paint-board mpuz-check-all-solved mpuz-close-game] 4 (#$ . 13705) ["P" (mpuz-mode)]])
(provide 'mpuz)
