%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/snake.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.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(require 'gamegrid)
#@42 Non-nil means use glyphs when available.
(defvar snake-use-glyphs-flag t (#$ . 428))
#@41 Non-nil means use color when available.
(defvar snake-use-color-flag t (#$ . 519))
#@29 Name used for Snake buffer.
(defvar snake-buffer-name "*Snake*" (#$ . 608))
#@34 Width of used portion of buffer.
(defvar snake-buffer-width 30 (#$ . 690))
#@35 Height of used portion of buffer.
(defvar snake-buffer-height 22 (#$ . 771))
#@24 Width of playing area.
(defvar snake-width 30 (#$ . 854))
#@25 Height of playing area.
(defvar snake-height 20 (#$ . 918))
#@26 Initial length of snake.
(defvar snake-initial-length 5 (#$ . 984))
#@30 Initial X position of snake.
(defvar snake-initial-x 10 (#$ . 1058))
#@30 Initial Y position of snake.
(defvar snake-initial-y 10 (#$ . 1133))
#@30 Initial X velocity of snake.
(defvar snake-initial-velocity-x 1 (#$ . 1208))
#@30 Initial Y velocity of snake.
(defvar snake-initial-velocity-y 0 (#$ . 1291))
#@61 The default time taken for the snake to advance one square.
(defvar snake-tick-period 0.2 (#$ . 1374))
#@31 Hook run upon starting Snake.
(defvar snake-mode-hook nil (#$ . 1483))
#@22 X position of score.
(defvar snake-score-x 0 (#$ . 1560))
#@22 Y position of score.
(defvar snake-score-y snake-height (#$ . 1624))
#@31 File for holding high scores.
(defvar snake-score-file "snake-scores" (#$ . 1699))
(defvar snake-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 snake-snake-options '(((glyph colorize) (emacs-tty 79) (t 32)) ((color-x color-x) (mono-x mono-x) (color-tty color-tty) (mono-tty mono-tty)) (((glyph color-x) [1 1 0]) (color-tty "yellow"))))
(defvar snake-dot-options '(((glyph colorize) (t 42)) ((color-x color-x) (mono-x grid-x) (color-tty color-tty)) (((glyph color-x) [1 0 0]) (color-tty "red"))))
(defvar snake-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 snake-space-options '(((t 32)) nil nil))
(defconst snake-blank 0)
(defconst snake-snake 1)
(defconst snake-dot 2)
(defconst snake-border 3)
(defconst snake-space 4)
(defvar snake-length 0)
(defvar snake-velocity-x 1)
(defvar snake-velocity-y 0)
(defvar snake-positions nil)
(defvar snake-score 0)
(defvar snake-paused nil)
(defvar snake-moved-p nil)
#@475 This queue stores the velocities requested too quickly by user.
They will take effect one at a time at each clock-interval.
This is necessary for proper behavior.

For instance, if you are moving right, you press up and then left, you
want the snake to move up just once before starting to move left.  If
we implemented all your keystrokes immediately, the snake would
effectively never move up.  Thus, we need to move it up for one turn
and then start moving it leftwards.
(defvar snake-velocity-queue nil (#$ . 2842))
(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!\207" [make-variable-buffer-local snake-length snake-velocity-x snake-velocity-y snake-positions snake-score snake-paused snake-moved-p snake-velocity-queue] 2)
#@25 Keymap for Snake games.
(defvar snake-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\313#\210\303\323\315#\210\303\324\317#\210\303\325\321#\210)\207" [map make-sparse-keymap snake-mode-map define-key "n" snake-start-game "q" snake-end-game "p" snake-pause-game [left] snake-move-left [right] snake-move-right [up] snake-move-up [down] snake-move-down "" "" "" ""] 4) (#$ . 3641))
#@34 Keymap for finished Snake games.
(defvar snake-null-map (byte-code "\301\302!\303\304\305#\210)\207" [map make-sparse-keymap snake-null-map define-key "n" snake-start-game] 4) (#$ . 4156))
#@46 Menu for `snake'.  Used to initialize menus.
(defconst snake--menu-def '("Snake" ["Start new game" snake-start-game :help "Start a new Snake game"] ["End game" snake-end-game :active (snake-active-p) :help "End the current Snake game"]) (#$ . 4354))
#@31 Menu for running Snake games.
(defvar snake-mode-menu nil (#$ . 4610))
(easy-menu-do-define 'snake-mode-menu snake-mode-map "Menu for running Snake games." snake--menu-def)
#@32 Menu for finished Snake games.
(defvar snake-null-menu nil (#$ . 4789))
(easy-menu-do-define 'snake-null-menu snake-null-map "Menu for finished Snake games." snake--menu-def)
(defalias 'snake-display-options #[nil "\306\307\310\"\307\311	\nW\203T	\211U\203\f\202K	
U\203&\202K	\fU\2032
\202K	U\203>\202K	U\203J\202K\312I\210	T\211\202\n*)\207" [options c --dotimes-limit-- snake-blank snake-blank-options snake-snake make-vector 256 nil 0 (nil nil nil) snake-snake-options snake-dot snake-dot-options snake-border snake-border-options snake-space snake-space-options] 5])
(defalias 'snake-update-score #[nil "\306\307\"\211G\211\310\fW\205$\311
\\\n	H#\210T\211\202
,\207" [snake-score string len x --dotimes-limit-- snake-score-x format "Score:  %05d" 0 gamegrid-set-cell snake-score-y] 6])
(defalias 'snake-init-buffer #[nil "\306	\n#\210\307\f\310\f
\fW\203<
\310\f\fW\2034\311
#\210T\211\202*
T\211\202*\312\f\313Z
X\203u\312
\313ZX\203m\311
#\210T\211\202V*
T\211\202E+\307\207" [snake-buffer-width snake-buffer-height snake-space buffer-read-only snake-height y gamegrid-init-buffer nil 0 gamegrid-set-cell 1 2 --dotimes-limit-- snake-width x snake-border #1=#:--cl-var-- #2=#:--cl-var-- snake-blank] 5])
(defalias 'snake-reset-game #[nil "\306 \210\307 \210\n\f\310
\311\310\211\310	\311W\203Z\312#\210\313\"
B
\\
\\T\211\202+,\314 \207" [snake-initial-length snake-length snake-initial-velocity-x snake-velocity-x snake-initial-velocity-y snake-velocity-y gamegrid-kill-timer snake-init-buffer nil 0 gamegrid-set-cell vector snake-update-score snake-positions snake-score snake-paused snake-moved-p snake-velocity-queue snake-initial-x snake-initial-y y x i --dotimes-limit-- snake-snake] 5])
(defalias 'snake-set-dot #[nil "\306!\306	!\307\n\"\fU\204\306!\306	!\202\310\n
#*\207" [snake-width snake-height y x snake-blank snake-dot random gamegrid-get-cell gamegrid-set-cell] 4])
#@131 Called on each clock tick.
Advances the snake one square, testing for collision.
Argument SNAKE-BUFFER is the name of the buffer.
(defalias 'snake-update-game #[(snake-buffer) "?\205\221p	=\205\221\306 \210\n@\211\307H\f\\\310H\\\311
\"\211U\2045U\203:\312 \202\220U\203UTT\313 \210\314 \210\202|\315Z\n\233\211A@\211\307H\310H\316#\210\317\241\210,\316
#\210\320
\"\nB\317\211,\207" [snake-paused snake-buffer snake-positions pos snake-velocity-x x snake-update-velocity 0 1 gamegrid-get-cell snake-end-game snake-update-score snake-set-dot 2 gamegrid-set-cell nil vector snake-velocity-y y c snake-border snake-snake snake-dot snake-length snake-score last-cons tail-pos x0 y0 snake-blank snake-moved-p] 5 (#$ . 6852)])
(defalias 'snake-update-velocity #[nil "?\205	\203\305	!@\211@\nA@	\237A\237)\306\211\207" [snake-moved-p snake-velocity-queue new-vel snake-velocity-x snake-velocity-y last t] 3])
(defalias 'snake-final-x-velocity #[nil "@@\206	\207" [snake-velocity-queue snake-velocity-x] 1])
(defalias 'snake-final-y-velocity #[nil "@A@\206	\207" [snake-velocity-queue snake-velocity-y] 1])
#@27 Make the snake move left.
(defalias 'snake-move-left #[nil "\301 \302U\205\f\303B\211\207" [snake-velocity-queue snake-final-x-velocity 0 (-1 0)] 2 (#$ . 8040) nil])
#@28 Make the snake move right.
(defalias 'snake-move-right #[nil "\301 \302U\205\f\303B\211\207" [snake-velocity-queue snake-final-x-velocity 0 (1 0)] 2 (#$ . 8215) nil])
#@25 Make the snake move up.
(defalias 'snake-move-up #[nil "\301 \302U\205\f\303B\211\207" [snake-velocity-queue snake-final-y-velocity 0 (0 -1)] 2 (#$ . 8391) nil])
#@27 Make the snake move down.
(defalias 'snake-move-down #[nil "\301 \302U\205\f\303B\211\207" [snake-velocity-queue snake-final-y-velocity 0 (0 1)] 2 (#$ . 8562) nil])
#@29 Terminate the current game.
(defalias 'snake-end-game #[nil "\303 \210\304!\210\305	\n\"\207" [snake-null-map snake-score-file snake-score gamegrid-kill-timer use-local-map gamegrid-add-score] 3 (#$ . 8736) nil])
#@28 Start a new game of Snake.
(defalias 'snake-start-game #[nil "\302 \210\303 \210\304!\210\305	\306\"\207" [snake-mode-map snake-tick-period snake-reset-game snake-set-dot use-local-map gamegrid-start-timer snake-update-game] 3 (#$ . 8956) nil])
#@37 Pause (or resume) the current game.
(defalias 'snake-pause-game #[nil "?\301\205	\302!\207" [snake-paused message "Game paused (press p to resume)"] 2 (#$ . 9208) nil])
(defalias 'snake-active-p #[nil "\301 =\207" [snake-mode-map current-local-map] 2])
(put 'snake-mode 'mode-class 'special)
(defvar snake-mode-hook nil)
(byte-code "\300\301N\204\f\302\300\301\303#\210\304\305!\204\302\305\306\307#\210\300\207" [snake-mode-hook variable-documentation put "Hook run after entering Snake mode.\nNo problems result if this variable is not bound.\n`add-hook' automatically binds it.  (This is true for all hook variables.)" boundp snake-mode-map definition-name snake-mode] 4)
(defvar snake-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\322#\207" [snake-mode-abbrev-table snake-mode-map variable-documentation put purecopy "Keymap for `snake-mode'." boundp snake-mode-syntax-table definition-name snake-mode (lambda (#1=#:def-tmp-var) (defvar snake-mode-syntax-table #1#)) make-syntax-table "Syntax table for `snake-mode'." (lambda (#1#) (defvar snake-mode-abbrev-table #1#)) define-abbrev-table nil "Abbrev table for `snake-mode'." derived-mode-parent special-mode] 5)
#@218 A mode for playing Snake.

In addition to any hooks its parent mode `special-mode' might have run,
this mode runs the hook `snake-mode-hook', as the final or penultimate step
during initialization.

\{snake-mode-map}
(defalias 'snake-mode #[nil "\306\300!\210\307\310 \210\311\312\310\313N\203\314\311\313\310\313N#\210\315!\204'\316\317 \"\210\320\f!\211\2036
\321 =\203<\322\f\323 \"\210)\324!\325\"\204V!\"=\204V\326!\325\"C#\210\327!\210\330\f!\210!\"\331\332\333\334\307$\210\327#!\210$%&'\335\336 !\210)\337\340!\207" [delay-mode-hooks major-mode mode-name snake-mode-map snake-mode-syntax-table parent make-local-variable t special-mode snake-mode "Snake" mode-class put keymap-parent set-keymap-parent current-local-map char-table-parent standard-syntax-table set-char-table-parent syntax-table abbrev-table-get :parents abbrev-table-put use-local-map set-syntax-table add-hook kill-buffer-hook gamegrid-kill-timer nil gamegrid-init snake-display-options run-mode-hooks snake-mode-hook snake-mode-abbrev-table local-abbrev-table snake-null-map snake-use-glyphs-flag gamegrid-use-glyphs snake-use-color-flag gamegrid-use-color] 6 (#$ . 10638) nil])
#@515 Play the Snake game.
Move the snake around without colliding with its tail or with the border.

Eating dots causes the snake to get longer.

Snake mode keybindings:
   \<snake-mode-map>
\[snake-start-game]	Starts a new game of Snake
\[snake-end-game]	Terminates the current game
\[snake-pause-game]	Pauses (or resumes) the current game
\[snake-move-left]	Makes the snake move left
\[snake-move-right]	Makes the snake move right
\[snake-move-up]	Makes the snake move up
\[snake-move-down]	Makes the snake move down
(defalias 'snake #[nil "\301!\210\302 \210\303 \210\304 \207" [snake-buffer-name switch-to-buffer gamegrid-kill-timer snake-mode snake-start-game] 2 (#$ . 11827) nil])
(provide 'snake)

Zerion Mini Shell 1.0