%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/share/emacs/27.2/lisp/play/
Upload File :
Create Path :
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\"\307\f\n\\
\\#\210\nT\211\202*\207	\306\nW\205M\310\f\n\\\311
\312#\"\f\307\f\n\\
\\\f#\210)\nT\211\202)*\207" [y tetris-width x --dotimes-limit-- tetris-top-left-x tetris-top-left-y 0 gamegrid-set-cell gamegrid-get-cell + -1 tetris-blank c] 7])
(defalias 'tetris-shift-down #[nil "\305	\nW\205.\306	!\203'T	\211\305Y\203&\307\f!\210\fS\211\202)	T\211\202*\207" [tetris-height y0 --dotimes-limit-- tetris-n-rows y 0 tetris-full-row tetris-shift-row] 3])
(defalias 'tetris-draw-border-p #[nil "\302=?\206	\207" [gamegrid-display-mode tetris-draw-border-with-glyphs glyph] 2])
(defalias 'tetris-init-buffer #[nil "\306	\n#\210\307\310 \203H\311

\f
X\203G\311X\203?\312\\\f\\#\210T\211\202\"*\fT\211\202*
\313\fW\203\202\313W\203z\312\\\f\\#\210T\211\202]*\fT\211\202N*\310 \205\272\311\211\314X\203\270\311\211\314X\203\260\312\\\f\\#\210T\211\202\224)\fT\211\202\213)\307)\207" [tetris-buffer-width tetris-buffer-height tetris-space buffer-read-only y tetris-height gamegrid-init-buffer nil tetris-draw-border-p -1 gamegrid-set-cell 0 4 #1=#:--cl-var-- x tetris-width #2=#:--cl-var-- tetris-top-left-x tetris-top-left-y tetris-border --dotimes-limit-- tetris-blank tetris-next-x tetris-next-y] 5])
(defalias 'tetris-reset-game #[nil "\306 \210\307 \210\310\311!\312\211\312\211\312\211
\312\313\314 \207" [tetris-next-shape tetris-shape tetris-rot tetris-pos-x tetris-pos-y tetris-n-shapes gamegrid-kill-timer tetris-init-buffer random 7 0 nil tetris-new-shape tetris-n-rows tetris-score tetris-paused] 3])
(defalias 'tetris-shape-done #[nil "\305 \210T	\nH\fH\\\306 \210\307 \207" [tetris-n-shapes tetris-score tetris-shape-scores tetris-shape tetris-rot tetris-shift-down tetris-update-score tetris-new-shape] 3])
#@79 Called on each clock tick.
Drops the shape one square, testing for collision.
(defalias 'tetris-update-game #[(tetris-buffer) "?\205'p	=\205'\304\305 \210T\306 \211\203S\307 \210\n\205&\310 )\207" [tetris-paused tetris-buffer hit tetris-pos-y nil tetris-erase-shape tetris-test-shape tetris-draw-shape tetris-shape-done] 3 (#$ . 12192)])
#@51 Drop the shape to the bottom of the playing area.
(defalias 'tetris-move-bottom #[nil "?\205!\303\304 \210	\204\nT\305 \211\203\nS\306 \210\307 )\207" [tetris-paused hit tetris-pos-y nil tetris-erase-shape tetris-test-shape tetris-draw-shape tetris-shape-done] 2 (#$ . 12548) nil])
#@40 Move the shape one square to the left.
(defalias 'tetris-move-left #[nil "?\205\302 \210	S\303 \203	T\304 \207" [tetris-paused tetris-pos-x tetris-erase-shape tetris-test-shape tetris-draw-shape] 1 (#$ . 12846) nil])
#@41 Move the shape one square to the right.
(defalias 'tetris-move-right #[nil "?\205\302 \210	T\303 \203	S\304 \207" [tetris-paused tetris-pos-x tetris-erase-shape tetris-test-shape tetris-draw-shape] 1 (#$ . 13076) nil])
#@42 Move the shape one square to the bottom.
(defalias 'tetris-move-down #[nil "?\205\302 \210	T\303 \203	S\304 \207" [tetris-paused tetris-pos-y tetris-erase-shape tetris-test-shape tetris-draw-shape] 1 (#$ . 13308) nil])
#@29 Rotate the shape clockwise.
(defalias 'tetris-rotate-prev #[nil "?\205\302 \210	T\303 \246\304 \203\305	\\\303 \246\306 \207" [tetris-paused tetris-rot tetris-erase-shape tetris-shape-rotations tetris-test-shape 3 tetris-draw-shape] 2 (#$ . 13540) nil])
#@33 Rotate the shape anticlockwise.
(defalias 'tetris-rotate-next #[nil "?\205\302 \210\303	\\\304 \246\305 \203	T\304 \246\306 \207" [tetris-paused tetris-rot tetris-erase-shape 3 tetris-shape-rotations tetris-test-shape tetris-draw-shape] 2 (#$ . 13807) nil])
#@29 Terminate the current game.
(defalias 'tetris-end-game #[nil "\303 \210\304!\210\305	\n\"\207" [tetris-null-map tetris-score-file tetris-score gamegrid-kill-timer use-local-map gamegrid-add-score] 3 (#$ . 14078) nil])
#@29 Start a new game of Tetris.
(defalias 'tetris-start-game #[nil "\303 \210\304!\210\305 \206
	\306\n\307\")\207" [tetris-mode-map tetris-default-tick-period period tetris-reset-game use-local-map tetris-get-tick-period gamegrid-start-timer tetris-update-game] 3 (#$ . 14303) nil])
#@37 Pause (or resume) the current game.
(defalias 'tetris-pause-game #[nil "?\301\205	\302!\207" [tetris-paused message "Game paused (press p to resume)"] 2 (#$ . 14592) nil])
(defalias 'tetris-active-p #[nil "\301 =\207" [tetris-mode-map current-local-map] 2])
(put 'tetris-mode 'mode-class 'special)
(defvar tetris-mode-hook nil)
(byte-code "\300\301N\204\f\302\300\301\303#\210\304\305!\204\302\305\306\307#\210\300\207" [tetris-mode-hook variable-documentation put "Hook run after entering Tetris mode.\nNo problems result if this variable is not bound.\n`add-hook' automatically binds it.  (This is true for all hook variables.)" boundp tetris-mode-map definition-name tetris-mode] 4)
(defvar tetris-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" [tetris-mode-abbrev-table tetris-mode-map variable-documentation put purecopy "Keymap for `tetris-mode'." boundp tetris-mode-syntax-table definition-name tetris-mode (lambda (#1=#:def-tmp-var) (defvar tetris-mode-syntax-table #1#)) make-syntax-table "Syntax table for `tetris-mode'." (lambda (#1#) (defvar tetris-mode-abbrev-table #1#)) define-abbrev-table nil "Abbrev table for `tetris-mode'." derived-mode-parent] 5)
#@149 A mode for playing Tetris.

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

\{tetris-mode-map}
(defalias 'tetris-mode #[nil "\306\300!\210\307\310 \210\311\312\313!\210\314\f!\210
\315\316\317\320\307$\210\313!\210\320\321\322 !\210)\323\324!\207" [delay-mode-hooks major-mode mode-name tetris-mode-map tetris-mode-syntax-table tetris-mode-abbrev-table make-local-variable t kill-all-local-variables tetris-mode "Tetris" use-local-map set-syntax-table add-hook kill-buffer-hook gamegrid-kill-timer nil gamegrid-init tetris-display-options run-mode-hooks tetris-mode-hook local-abbrev-table tetris-null-map show-trailing-whitespace tetris-use-glyphs gamegrid-use-glyphs tetris-use-color gamegrid-use-color] 5 (#$ . 16030) nil])
#@687 Play the Tetris game.
Shapes drop from the top of the screen, and the user has to move and
rotate the shape to fit in with those at the bottom of the screen so
as to form complete rows.

tetris-mode keybindings:
   \<tetris-mode-map>
\[tetris-start-game]	Starts a new game of Tetris
\[tetris-end-game]	Terminates the current game
\[tetris-pause-game]	Pauses (or resumes) the current game
\[tetris-move-left]	Moves the shape one square to the left
\[tetris-move-right]	Moves the shape one square to the right
\[tetris-rotate-prev]	Rotates the shape clockwise
\[tetris-rotate-next]	Rotates the shape anticlockwise
\[tetris-move-bottom]	Drops the shape to the bottom of the playing area


(defalias 'tetris #[nil "\301\302!\206	\303 !\210\304!\210\305 \210\306 \210\307 \207" [tetris-buffer-name select-window get-buffer-window selected-window switch-to-buffer gamegrid-kill-timer tetris-mode tetris-start-game] 3 (#$ . 16835) nil])
(provide 'tetris)

Zerion Mini Shell 1.0