?
Current Path : /usr/share/emacs/24.3/lisp/play/ |
Linux gator3171.hostgator.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 |
Current File : //usr/share/emacs/24.3/lisp/play/blackbox.elc |
;ELC ;;; Compiled by mockbuild@buildfarm06-new.corp.cloudlinux.com on Fri Oct 11 10:06:34 2024 ;;; from file /builddir/build/BUILD/emacs-24.3/lisp/play/blackbox.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. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; #@17 Blackbox board. (defvar bb-board nil (#$ . 556)) #@21 Current x-position. (defvar bb-x -1 (#$ . 611)) #@21 Current y-position. (defvar bb-y -1 (#$ . 665)) #@16 Current score. (defvar bb-score 0 (#$ . 719)) #@20 Number of detours. (defvar bb-detour-count 0 (#$ . 771)) #@31 List of already placed balls. (defvar bb-balls-placed nil (#$ . 834)) #@67 Redefine keys that run the function OLDFUN to run NEWFUN instead. (defalias 'blackbox-redefine-key #[(map oldfun newfun) "\303\304\305 \"\n#\207" [map oldfun newfun define-key vector remap] 5 (#$ . 910)]) (defvar blackbox-mode-map (byte-code "\301 \302\303\"\210\304\305\306#\210\304\307\306#\210\304\310\311#\210\304\312\311#\210\304\313\314#\210\304\315\316#\210\304\317\320#\210\304\321\322#\210\323\324\325#\210\323\326\327#\210\323\330\325#\210\323\331\332#\210\304\333\332#\210)\207" [map make-keymap suppress-keymap t blackbox-redefine-key backward-char bb-left left-char forward-char bb-right right-char previous-line bb-up next-line bb-down move-end-of-line bb-eol move-beginning-of-line bb-bol define-key " " bb-romp "q" bury-buffer [insert] [return] bb-done newline] 4)) (put 'blackbox-mode 'mode-class 'special) #@370 Major mode for playing blackbox. To learn how to play blackbox, see the documentation for function `blackbox'. The usual mnemonic keys move the cursor around the box. \<blackbox-mode-map>\[bb-bol] and \[bb-eol] move to the beginning and end of line, respectively. \[bb-romp] -- send in a ray from point, or toggle a ball at point \[bb-done] -- end game and get score (defalias 'blackbox-mode #[nil "\304 \210\305!\210\306\307\310\311\312!\207" [blackbox-mode-map truncate-lines major-mode mode-name kill-all-local-variables use-local-map t blackbox-mode "Blackbox" run-mode-hooks blackbox-mode-hook] 2 (#$ . 1758) nil]) #@4905 Play blackbox. Optional prefix argument is the number of balls; the default is 4. What is blackbox? Blackbox is a game of hide and seek played on an 8 by 8 grid (the Blackbox). Your opponent (Emacs, in this case) has hidden several balls (usually 4) within this box. By shooting rays into the box and observing where they emerge it is possible to deduce the positions of the hidden balls. The fewer rays you use to find the balls, the lower your score. Overview of play: \<blackbox-mode-map>To play blackbox, type \[blackbox]. An optional prefix argument specifies the number of balls to be hidden in the box; the default is four. The cursor can be moved around the box with the standard cursor movement keys. To shoot a ray, move the cursor to the edge of the box and press SPC. The result will be determined and the playfield updated. You may place or remove balls in the box by moving the cursor into the box and pressing \[bb-romp]. When you think the configuration of balls you have placed is correct, press \[bb-done]. You will be informed whether you are correct or not, and be given your score. Your score is the number of letters and numbers around the outside of the box plus five for each incorrectly placed ball. If you placed any balls incorrectly, they will be indicated with `x', and their actual positions indicated with `o'. Details: There are three possible outcomes for each ray you send into the box: Detour: the ray is deflected and emerges somewhere other than where you sent it in. On the playfield, detours are denoted by matching pairs of numbers -- one where the ray went in, and the other where it came out. Reflection: the ray is reflected and emerges in the same place it was sent in. On the playfield, reflections are denoted by the letter `R'. Hit: the ray strikes a ball directly and is absorbed. It does not emerge from the box. On the playfield, hits are denoted by the letter `H'. The rules for how balls deflect rays are simple and are best shown by example. As a ray approaches a ball it is deflected ninety degrees. Rays can be deflected multiple times. In the diagrams below, the dashes represent empty box locations and the letter `O' represents a ball. The entrance and exit points of each ray are marked with numbers as described under "Detour" above. Note that the entrance and exit points are always interchangeable. `*' denotes the path taken by the ray. Note carefully the relative positions of the ball and the ninety degree deflection it causes. 1 - * - - - - - - - - - - - - - - - - - - - - - - - * - - - - - - - - - - - - - - - - - - - - - - 1 * * - - - - - - - - - - - - - - - O - - - - O - - - O - - - - - - - O - - - - - - - * * * * - - - - - - - - - - - - - * * * * * 2 3 * * * - - * - - - - - - - - - - - - - * - - - - - - - O - * - - - - - - - - - - - - - * - - - - - - - - * * - - - - - - - - - - - - - * - - - - - - - - * - O - 2 3 As mentioned above, a reflection occurs when a ray emerges from the same point it was sent in. This can happen in several ways: - - - - - - - - - - - - - - - - - - - - - - - - - - - - O - - - - - O - O - - - - - - - - - - - R * * * * - - - - - - - * - - - - O - - - - - - - - - - - O - - - - - - * - - - - R - - - - - - - - - - - - - - - - - - - * - - - - - - - - - - - - - - - - - - - - - - - * - - - - - - - - - - - - - - - - - - - - R * * * * - - - - - - - - - - - - - - - - - - - - - - - - O - - - - - - - - - - - In the first example, the ray is deflected downwards by the upper ball, then left by the lower ball, and finally retraces its path to its point of origin. The second example is similar. The third example is a bit anomalous but can be rationalized by realizing the ray never gets a chance to get into the box. Alternatively, the ray can be thought of as being deflected downwards and immediately emerging from the box. A hit occurs when a ray runs straight into a ball: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - O - - - - - - - - - - - - - - - O - - - H * * * * - - - - - - - - - - - - H * * * * O - - - - - - * - - - - - - - - - - - - - - - - O - - - - - - O - - - - H * * * O - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Be sure to compare the second example of a hit with the first example of a reflection. (defalias 'blackbox #[(num) "\306\307!\210\310 \210\311\312p!\210\313 \206 \314!\315\316\211\317\211\320 \210\321\f B!\207" [buffer-read-only num bb-board bb-balls-placed bb-x bb-y switch-to-buffer "*Blackbox*" blackbox-mode t buffer-disable-undo bb-init-board 4 nil -1 0 bb-insert-board bb-goto bb-score bb-detour-count] 4 (#$ . 2392) "P"]) (defalias 'bb-init-board #[(num-balls) "\303\211\nS\211\304Y\203\"