%PDF- %PDF-
Direktori : /usr/local/share/emacs/27.2/lisp/play/ |
Current File : //usr/local/share/emacs/27.2/lisp/play/tetris.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!\210\302\303\304\305\306\307\310\311&\210\312\313\314\315\310\303\316\317&\210\312\320\314\321\310\303\316\317&\210\312\322\314\323\310\303\316\317&\210\312\324\325\326\310\303\316\327&\210\312\330\331\332\310\303\316\333&\210\312\334\304\335\310\303\316\336&\210\312\337\340\341\310\303\316\342&\210\312\343\344\345\310\303\316\346&\210\312\347\350\351\310\303\316\352&\210\312\353\354\355\310\303\316\327&\210\312\356\357\360\310\303\316\327&\210\312\361\362\363\310\303\316\327&\210\312\364\365\366\310\303\316\327&\210\312\367\370\371\310\303\316\327&\210\312\372\373\374\310\303\316\327&\207" [require gamegrid custom-declare-group tetris nil "Play a game of Tetris." :prefix "tetris-" :group games custom-declare-variable tetris-use-glyphs t "Non-nil means use glyphs when available." :type boolean tetris-use-color "Non-nil means use color when available." tetris-draw-border-with-glyphs "Non-nil means draw a border even when using glyphs." tetris-default-tick-period 0.3 "The default time taken for a shape to drop one row." number tetris-update-speed-function 'tetris-default-update-speed-function "Function run whenever the Tetris score changes.\nCalled with two arguments: (SHAPES ROWS)\nSHAPES is the number of shapes which have been dropped.\nROWS is the number of rows which have been completed.\n\nIf the return value is a number, it is used as the timer period." function tetris-mode-hook "Hook run upon starting Tetris." hook tetris-tty-colors ["blue" "white" "yellow" "magenta" "cyan" "green" "red"] "Vector of colors of the various shapes in text mode." (vector (color :tag "Shape 1") (color :tag "Shape 2") (color :tag "Shape 3") (color :tag "Shape 4") (color :tag "Shape 5") (color :tag "Shape 6") (color :tag "Shape 7")) tetris-x-colors [[0 0 1] [0.7 0 1] [1 1 0] [1 0 1] [0 1 1] [0 1 0] [1 0 0]] "Vector of RGB colors of the various shapes." (vector (vector :tag "Shape 1" number number number) (vector :tag "Shape 2" number number number) (vector :tag "Shape 3" number number number) (vector :tag "Shape 4" number number number) (vector :tag "Shape 5" number number number) (vector :tag "Shape 6" number number number) (vector :tag "Shape 7" number number number)) tetris-buffer-name "*Tetris*" "Name used for Tetris buffer." string tetris-buffer-width 30 "Width of used portion of buffer." tetris-buffer-height 22 "Height of used portion of buffer." tetris-width 10 "Width of playing area." tetris-height 20 "Height of playing area." tetris-top-left-x 3 "X position of top left of playing area." tetris-top-left-y 1 "Y position of top left of playing area."] 8) #@27 X position of next shape. (defvar tetris-next-x (byte-code "\302_ \\\207" [tetris-top-left-x tetris-width 2] 2) (#$ . 3033)) #@27 Y position of next shape. (defvar tetris-next-y tetris-top-left-y (#$ . 3165)) #@22 X position of score. (defvar tetris-score-x tetris-next-x (#$ . 3250)) #@22 Y position of score. (defvar tetris-score-y (+ tetris-next-y 6) (#$ . 3327)) #@31 File for holding high scores. (defvar tetris-score-file "tetris-scores" (#$ . 3410)) (defvar tetris-blank-options '(((glyph colorize) (t 32)) ((color-x color-x) (mono-x grid-x) (color-tty color-tty)) (((glyph color-x) [0 0 0]) (color-tty "black")))) (defvar tetris-cell-options '(((glyph colorize) (emacs-tty 79) (t 32)) ((color-x color-x) (mono-x mono-x) (color-tty color-tty) (mono-tty mono-tty)))) (defvar tetris-border-options '(((glyph colorize) (t 43)) ((color-x color-x) (mono-x grid-x) (color-tty color-tty)) (((glyph color-x) [0.5 0.5 0.5]) (color-tty "white")))) (defvar tetris-space-options '(((t 32)) nil nil)) #@99 Each shape is described by a vector that contains the coordinates of each one of its four blocks. (defconst tetris-shapes [[[[0 0] [1 0] [0 1] [1 1]]] [[[0 0] [1 0] [2 0] [2 1]] [[1 -1] [1 0] [1 1] [0 1]] [[0 -1] [0 0] [1 0] [2 0]] [[1 -1] [2 -1] [1 0] [1 1]]] [[[0 0] [1 0] [2 0] [0 1]] [[0 -1] [1 -1] [1 0] [1 1]] [[2 -1] [0 0] [1 0] [2 0]] [[1 -1] [1 0] [1 1] [2 1]]] [[[0 0] [1 0] [1 1] [2 1]] [[1 0] [0 1] [1 1] [0 2]]] [[[1 0] [2 0] [0 1] [1 1]] [[0 0] [0 1] [1 1] [1 2]]] [[[1 0] [0 1] [1 1] [2 1]] [[1 0] [1 1] [2 1] [1 2]] [[0 1] [1 1] [2 1] [1 2]] [[1 0] [0 1] [1 1] [1 2]]] [[[0 0] [1 0] [2 0] [3 0]] [[1 -1] [1 0] [1 1] [1 2]]]] (#$ . 4039)) (defconst tetris-shape-scores [[6] [6 7 6 7] [6 7 6 7] [6 7] [6 7] [5 5 6 5] [5 8]]) (defconst tetris-shape-dimensions [[2 2] [3 2] [3 2] [3 2] [3 2] [3 2] [4 1]]) (defconst tetris-blank 7) (defconst tetris-border 8) (defconst tetris-space 9) (defalias 'tetris-default-update-speed-function #[(_shapes rows) "\301\302\\\245\207" [rows 20.0 50.0] 3]) (defvar tetris-shape 0) (defvar tetris-rot 0) (defvar tetris-next-shape 0) (defvar tetris-n-shapes 0) (defvar tetris-n-rows 0) (defvar tetris-score 0) (defvar tetris-pos-x 0) (defvar tetris-pos-y 0) (defvar tetris-paused nil) (byte-code "\300\301!\210\300\302!\210\300\303!\210\300\304!\210\300\305!\210\300\306!\210\300\307!\210\300\310!\210\300\311!\207" [make-variable-buffer-local tetris-shape tetris-rot tetris-next-shape tetris-n-shapes tetris-n-rows tetris-score tetris-pos-x tetris-pos-y tetris-paused] 2) #@26 Keymap for Tetris games. (defvar tetris-mode-map (byte-code "\301\302!\303\304\305#\210\303\306\307#\210\303\310\311#\210\303\312\313#\210\303\314\315#\210\303\316\317#\210\303\320\321#\210\303\322\323#\210)\207" [map make-sparse-keymap tetris-mode-map define-key "n" tetris-start-game "q" tetris-end-game "p" tetris-pause-game " " tetris-move-bottom [left] tetris-move-left [right] tetris-move-right [up] tetris-rotate-prev [down] tetris-move-down] 4) (#$ . 5564)) #@35 Keymap for finished Tetris games. (defvar tetris-null-map (byte-code "\301\302!\303\304\305#\210\303\306\307#\210)\207" [map make-sparse-keymap tetris-null-map define-key "n" tetris-start-game "q" quit-window] 4) (#$ . 6046)) #@47 Menu for `tetris'. Used to initialize menus. (defconst tetris--menu-def '("Tetris" ["Start new game" tetris-start-game :help "Start a new Tetris game"] ["End game" tetris-end-game :active (tetris-active-p) :help "End the current Tetris game"]) (#$ . 6282)) #@32 Menu for running Tetris games. (defvar tetris-mode-menu nil (#$ . 6546)) (easy-menu-do-define 'tetris-mode-menu tetris-mode-map "Menu for running Tetris games." tetris--menu-def) #@33 Menu for finished Tetris games. (defvar tetris-null-menu nil (#$ . 6731)) (easy-menu-do-define 'tetris-null-menu tetris-null-map "Menu for finished Tetris games." tetris--menu-def) (defalias 'tetris-display-options #[nil "\306\307\310\"\307\311 \nW\203_ \211U\203 \f\202V \311Y\203= \312X\203= \313 \314 HD\315 HD\316BBC\"\202V U\203I \202V U\203U \202V \317I\210 T\211\202\n *)\207" [options c --dotimes-limit-- tetris-blank tetris-blank-options tetris-cell-options make-vector 256 nil 0 6 append (glyph color-x) color-tty ((t nil)) (nil nil nil) tetris-x-colors tetris-tty-colors tetris-border tetris-border-options tetris-space tetris-space-options] 9]) (defalias 'tetris-get-tick-period #[nil "\304\300!\205 \n\"\211\247\205 )\207" [tetris-update-speed-function tetris-n-shapes tetris-n-rows period boundp] 4]) (defalias 'tetris-get-shape-cell #[(block) " H\nHH\207" [tetris-shapes tetris-shape tetris-rot block] 2]) (defalias 'tetris-shape-width #[nil " H\302H\207" [tetris-shape-dimensions tetris-shape 0] 2]) (defalias 'tetris-shape-rotations #[nil " HG\207" [tetris-shapes tetris-shape] 2]) (defalias 'tetris-draw-score #[nil "\306\307\310\"\307\311 \"\307\312\n\"#\313\314\f W\205P \fH\211G\211\314 W\203H \315\\\f\\H#\210T\211\202) ,\fT\211\202 +\207" [tetris-n-shapes tetris-n-rows tetris-score strings y --dotimes-limit-- vector format "Shapes: %05d" "Rows: %05d" "Score: %05d" 3 0 gamegrid-set-cell string len x tetris-score-x tetris-score-y] 7]) (defalias 'tetris-update-score #[nil "\301 \210\302 \211\205 \303!)\207" [period tetris-draw-score tetris-get-tick-period gamegrid-set-timer] 3]) (defalias 'tetris-new-shape #[nil "\306\307\310!\311 Z\312\245\306\313 \203 \314 \207\315 \210\316 \210\317 \207" [tetris-next-shape tetris-shape tetris-rot tetris-width tetris-pos-x tetris-pos-y 0 random 7 tetris-shape-width 2 tetris-test-shape tetris-end-game tetris-draw-shape tetris-draw-next-shape tetris-update-score] 2]) (defalias 'tetris-draw-next-shape #[nil "\306\307 W\203- \306\307\n W\203% \310\\\f\n\\ #\210\nT\211\202 *T\211\202 *\306\307 W\205` \f\307 \310\311!\307H\\\f\311!\312H\\#\210*T\211\2025 *\207" [x --dotimes-limit-- y tetris-next-x tetris-next-y tetris-blank 4 0 gamegrid-set-cell tetris-get-shape-cell 1 i tetris-next-shape tetris-rot tetris-shape] 6]) (defalias 'tetris-draw-shape #[nil "\306\307 W\205* \310!\311\312\f\n\307H#\312 \f\n\313H# #\210)T\211\202 *\207" [i --dotimes-limit-- c tetris-top-left-x tetris-pos-x tetris-top-left-y 4 0 tetris-get-shape-cell gamegrid-set-cell + 1 tetris-pos-y tetris-shape] 8]) (defalias 'tetris-erase-shape #[nil "\306\307 W\205* \310!\311\312\f\n\307H#\312 \f\n\313H# #\210)T\211\202 *\207" [i --dotimes-limit-- c tetris-top-left-x tetris-pos-x tetris-top-left-y 4 0 tetris-get-shape-cell gamegrid-set-cell + 1 tetris-pos-y tetris-blank] 8]) (defalias 'tetris-test-shape #[nil "\306\307\310 \nW\203I \204B \311 !\f\310H\\\f\312H\\ Y\206@ Y\206@ \313 \\ \\\"U?+ T\211\202 *)\207" [hit i --dotimes-limit-- c tetris-pos-x xx nil 4 0 tetris-get-shape-cell 1 gamegrid-get-cell tetris-pos-y yy tetris-width tetris-height tetris-top-left-x tetris-top-left-y tetris-blank] 5]) (defalias 'tetris-full-row #[(y) "\306 \307\nW\203$ \310\f\n\\ \n\\\"U\203 \311\nT\211\202 *)\207" [full tetris-width x --dotimes-limit-- tetris-top-left-x tetris-top-left-y t 0 gamegrid-get-cell nil y tetris-blank] 5]) (defalias 'tetris-shift-row #[(y) "\306U\203$ \306\nW\205\"