%PDF- %PDF-
Direktori : /usr/local/share/emacs/27.2/lisp/play/ |
Current File : //usr/local/share/emacs/27.2/lisp/play/mpuz.elc |
;ELC ;;; Compiled ;;; in Emacs version 27.2 ;;; 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) (#$ . 1714)) (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 Mult Puzzle 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)) (byte-code "\301\302N\204 \303\301\302\304\305!#\210\306\307!\204 \303\307\310\311#\210\312\313 !\210\307\302N\204- \303\307\302\304\314!#\210\306\300!\204B \303\300\310\311#\210\315\316\300\317\"\210!\210\300\302N\204P \303\300\302\304\320!#\210\303\311\321\317#\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 (lambda (#1=#:def-tmp-var) (defvar mpuz-mode-syntax-table #1#)) make-syntax-table "Syntax table for `mpuz-mode'." (lambda (#1#) (defvar mpuz-mode-abbrev-table #1#)) define-abbrev-table nil "Abbrev table for `mpuz-mode'." derived-mode-parent] 5) #@555 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]. This mode runs the hook `mpuz-mode-hook', as the final or penultimate step during initialization. (defalias 'mpuz-mode #[nil "\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 (#$ . 3167) nil]) #@40 Number of errors made in current game. (defvar mpuz-nb-errors 0 (#$ . 4122)) #@28 Number of games completed. (defvar mpuz-nb-completed-games 0 (#$ . 4205)) #@42 Number of errors made in previous games. (defvar mpuz-nb-cumulated-errors 0 (#$ . 4285)) #@42 True if a game is currently in progress. (defvar mpuz-in-progress nil (#$ . 4380)) #@54 A vector recording which digits have been decrypted. (defvar mpuz-found-digits (make-bool-vector 10 nil) (#$ . 4469)) #@59 A vector recording which digits have been solved for you. (defvar mpuz-trivial-digits (make-bool-vector 10 nil) (#$ . 4593)) (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) (#$ . 4866)) #@40 The inverse of `mpuz-digit-to-letter'. (defvar mpuz-letter-to-digit (make-vector 10 0) (#$ . 4970)) (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 (#$ . 5281)]) #@73 The board associates to any digit the list of squares where it appears. (defvar mpuz-board (make-vector 10 nil) (#$ . 5617)) #@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 (#$ . 5748)]) #@62 Check whether all digits have been solved. Return t if yes. (defalias 'mpuz-check-all-solved #[(&optional row col) "\3062\307\211\211\211\211\211\211\203\374 \204\374 \206% \310\311\312\"\f\206. \310\311\313\" \2066 \310\314!\206? \310\315!\211\203M \203M \f\204^ \203k \204^ \203k \f\203k \316 \210\317 \210\320\306\321\"\202\371 \n\206r \310\322!\206z \310\323!\211\203\215 \n\203\215 \204\215 \316\314!\202\371 \203\245 \n=\204\245 \316\n\203\240 \323\202\241 \322!\202\371 \203\303 \f=\204\303 \316\203\271 \311\202\272 \323\205\277 \313\"\202\371 \203\341 \n=\204\341 \316\n\203\327 \311\202\330 \322\n\205\335 \312\"\202\371 \204\374 \f\203\356 \204\366 \203\374 \n\203\374 \316\315!\204 \317 \210\324\325\326\"\210.\3210\207" [squares E D C B2 B1 solved nil mpuz-check-all-solved 4 7 9 10 2 mpuz-solve mpuz-paint-board throw 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 (#$ . 6059)]) #@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 (#$ . 7235)]) #@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 . . . . ." (#$ . 7860)) #@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 (#$ . 8140)]) (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 (#$ . 8736)]) #@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\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 (#$ . 8950)]) #@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 (#$ . 9276)]) #@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\"