MMCT TEAM
Server IP : 111.118.215.189  /  Your IP : 3.128.31.200
Web Server : Apache
System : Linux md-in-83.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : a1673wkz ( 2475)
PHP Version : 8.2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /usr/share/emacs/24.3/lisp/play/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : //usr/share/emacs/24.3/lisp/play/mpuz.elc
;ELC
;;; Compiled by mockbuild@buildfarm06-new.corp.cloudlinux.com on Fri Oct 11 10:06:36 2024
;;; from file /builddir/build/BUILD/emacs-24.3/lisp/play/mpuz.el
;;; in Emacs version 24.3.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\312\313\314\315\306\301&\210\310\316\317\320\314\321\306\301&\210\310\322\302\323\314\321\306\301&\210\324\325\326\327\306\301%\210\324\330\331\332\306\301%\210\324\333\334\335\306\301%\210\324\336\337\340\306\301%\210\310\341\302\342\314\343\306\301&\207" [custom-declare-group mpuz nil "Multiplication puzzle." :prefix "mpuz-" :group games custom-declare-variable mpuz-silent 'error "Set this to nil if you want dings on inputs.\nThe value t means never ding, and `error' means only ding on wrong input." :type (choice (const :tag "No" nil) (const :tag "Yes" t) (const :tag "If correct" error)) mpuz-solve-when-trivial t "Solve any row that can be trivially calculated from what you've found." boolean mpuz-allow-double-multiplicator "Allow 2nd factors like 33 or 77." custom-declare-face mpuz-unsolved ((default :weight bold) (((class color)) :foreground "red1")) "Face for letters to be solved." mpuz-solved ((default :weight bold) (((class color)) :foreground "green1")) "Face for solved digits." mpuz-trivial ((default :weight bold) (((class color)) :foreground "blue")) "Face for trivial digits solved for you." mpuz-text ((t :inherit variable-pitch)) "Face for text on right." mpuz-mode-hook "Hook to run upon entry to mpuz." hook] 8)
#@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) (#$ . 1858))
#@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 (#$ . 2206) nil])
#@40 Number of errors made in current game.
(defvar mpuz-nb-errors 0 (#$ . 2907))
#@28 Number of games completed.
(defvar mpuz-nb-completed-games 0 (#$ . 2990))
#@42 Number of errors made in previous games.
(defvar mpuz-nb-cumulated-errors 0 (#$ . 3070))
#@42 True if a game is currently in progress.
(defvar mpuz-in-progress nil (#$ . 3165))
#@54 A vector recording which digits have been decrypted.
(defvar mpuz-found-digits (make-bool-vector 10 nil) (#$ . 3254))
#@59 A vector recording which digits have been solved for you.
(defvar mpuz-trivial-digits (make-bool-vector 10 nil) (#$ . 3378))
(defalias 'mpuz-digit-solved-p '(macro . #[(digit) "\301\302\303E\302\304EE\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) (#$ . 3651))
#@40 The inverse of `mpuz-digit-to-letter'.
(defvar mpuz-letter-to-digit (make-vector 10 0) (#$ . 3755))
(defalias 'mpuz-to-digit '(macro . #[(letter) "\301\302E\207" [letter aref mpuz-letter-to-digit] 3]))
(defalias 'mpuz-to-letter '(macro . #[(digit) "\301\302E\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 (#$ . 4066)])
#@73 The board associates to any digit the list of squares where it appears.
(defvar mpuz-board (make-vector 10 nil) (#$ . 4402))
#@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\210A\211\204\n\306+\207" [digit columns column --dolist-tail-- number mpuz-board nil 10 row] 6 (#$ . 4533)])
#@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 (#$ . 4844)])
#@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\317Z!\\\310\211\310\211\f\312\317Z!\\\211U\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 (#$ . 6054)])
#@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 . . . . ." (#$ . 6679))
#@53 Create (or recreate) the puzzle buffer.  Return it.
(defalias 'mpuz-create-buffer #[nil "\304\305!\306\307r\nq\210\310 \210c\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 (#$ . 6959)])
(defalias 'mpuz-paint-number #[(n &optional eol words) "\210\304`\n\206\305[v\210`|\210c)\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 (#$ . 7555)])
#@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 (#$ . 7769)])
#@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 (#$ . 8101)])
#@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\303A!\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 (#$ . 8305)])
#@37 Get the puzzle buffer if it exists.
(defalias 'mpuz-get-buffer #[nil "\300\301!\207" [get-buffer "*Mult Puzzle*"] 2 (#$ . 8840)])
#@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 (#$ . 8976)])
#@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 (#$ . 9230)])
#@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 (#$ . 9618) 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 (#$ . 9820) nil])
#@34 Ask for user proposal in puzzle.
(defalias 'mpuz-ask-for-try #[nil "\300\301!\207" [message "Your try?"] 2 (#$ . 10177)])
#@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 (#$ . 10305)])
#@41 Propose a digit for a letter in puzzle.
(defalias 'mpuz-try-letter #[nil "\203m\306\211\211\f\226
\307ZH\nH\204!\nH\203,\310\311\"\210\312\313!\202k\nH\204>\310\314\"\210\312\313!\202k\310\315\"\210\316 \211\317=\203O\316 	\320V\204[	\321W\203g\310\322	#\210\312\313!\202k\323	\"+\207\324\325!\203v\326 \207\310\327!\207" [mpuz-in-progress digit-char digit letter-char last-command-event mpuz-letter-to-digit 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." mpuz-found-digits mpuz-trivial-digits mpuz-board] 5 (#$ . 10497) 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\\\"\202iH\2041H\2038\310\312\n\"\202i
U\203X\310\313\n#\210\314\315!\210\316I\210\317 \205i\320 \202i\310\321\n#\210\314\316!\210T\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-found-digits mpuz-trivial-digits mpuz-nb-errors] 4 (#$ . 11204)])
#@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 (#$ . 11858)])
#@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 (#$ . 12619)])
#@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 (#$ . 12938) "P"])
(provide 'mpuz)

MMCT - 2023