403Webshell
Server IP : 217.160.0.212  /  Your IP : 216.73.216.71
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1073854427 ( 1073854427)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /usr/share/emacs/28.2/lisp/play/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/emacs/28.2/lisp/play/snake.elc
;ELC
;;; Compiled
;;; in Emacs version 28.2
;;; with all optimizations.



(require 'gamegrid)
#@42 Non-nil means use glyphs when available.
(defvar snake-use-glyphs-flag t (#$ . 104))
#@41 Non-nil means use color when available.
(defvar snake-use-color-flag t (#$ . 195))
#@29 Name used for Snake buffer.
(defvar snake-buffer-name "*Snake*" (#$ . 284))
#@34 Width of used portion of buffer.
(defvar snake-buffer-width 30 (#$ . 366))
#@35 Height of used portion of buffer.
(defvar snake-buffer-height 22 (#$ . 447))
#@24 Width of playing area.
(defvar snake-width 30 (#$ . 530))
#@25 Height of playing area.
(defvar snake-height 20 (#$ . 594))
#@26 Initial length of snake.
(defvar snake-initial-length 5 (#$ . 660))
#@30 Initial X position of snake.
(defvar snake-initial-x 10 (#$ . 734))
#@30 Initial Y position of snake.
(defvar snake-initial-y 10 (#$ . 808))
#@30 Initial X velocity of snake.
(defvar snake-initial-velocity-x 1 (#$ . 882))
#@30 Initial Y velocity of snake.
(defvar snake-initial-velocity-y 0 (#$ . 964))
#@61 The default time taken for the snake to advance one square.
(defvar snake-tick-period 0.2 (#$ . 1046))
#@31 Hook run upon starting Snake.
(defvar snake-mode-hook nil (#$ . 1155))
#@22 X position of score.
(defvar snake-score-x 0 (#$ . 1232))
#@22 Y position of score.
(defvar snake-score-y snake-height (#$ . 1296))
#@31 File for holding high scores.
(defvar snake-score-file "snake-scores" (#$ . 1371))
(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 nil)
(make-variable-buffer-local 'snake-length)
(defvar snake-velocity-x 1 nil)
(make-variable-buffer-local 'snake-velocity-x)
(defvar snake-velocity-y 0 nil)
(make-variable-buffer-local 'snake-velocity-y)
(defvar snake-positions nil nil)
(make-variable-buffer-local 'snake-positions)
(defvar snake-score 0 nil)
(make-variable-buffer-local 'snake-score)
(defvar snake-paused nil nil)
(make-variable-buffer-local 'snake-paused)
(defvar snake-moved-p nil nil)
(make-variable-buffer-local 'snake-moved-p)
#@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 (#$ . 2854))
(make-variable-buffer-local 'snake-velocity-queue)
#@25 Keymap for Snake games.
(defvar snake-mode-map (byte-code "\300\301!\302\303\304#\210\302\305\306#\210\302\307\310#\210\302\311\312#\210\302\313\314#\210\302\315\316#\210\302\317\320#\210\302\321\312#\210\302\322\314#\210\302\323\316#\210\302\324\320#\210\207" [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 "" "" "" ""] 5) (#$ . 3431))
#@34 Keymap for finished Snake games.
(defvar snake-null-map (byte-code "\300\301!\302\303\304#\210\302\305\306#\210\207" [make-sparse-keymap snake-null-map define-key "n" snake-start-game "q" quit-window] 5) (#$ . 3939))
#@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"]) (#$ . 4164))
#@31 Menu for running Snake games.
(defvar snake-mode-menu nil (#$ . 4420))
(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 (#$ . 4599))
(easy-menu-do-define 'snake-null-menu snake-null-map "Menu for finished Snake games." snake--menu-def)
(defalias 'snake-display-options #[0 "\306\307\310\"\311\211\307W\203M\211U\203	\202D\nU\203!\202D\fU\203+
\202DU\2037\f\202D
U\203C\202D\312I\210\211T\262\202\210\207" [snake-blank snake-blank-options snake-snake snake-snake-options snake-dot snake-dot-options make-vector 256 nil 0 (nil nil nil) snake-border snake-border-options snake-space snake-space-options] 6])
(defalias 'snake-update-score #[0 "\303\304\"\211G\305\211W\205\306	\\\nH#\210\211T\262\202\207" [snake-score snake-score-x snake-score-y format "Score:  %05d" 0 gamegrid-set-cell] 8])
(defalias 'snake-init-buffer #[0 "\306	\n#\210\307\f\310\211W\203/
\310\211W\203&\311\f#\210\211T\262\202\266\211T\262\202\n\266\312\f\313ZX\203\\\312
\313ZX\203S\311
#\210T\262\202?\266T\262\2025\307\266\202)\207" [snake-buffer-width snake-buffer-height snake-space buffer-read-only snake-height snake-width gamegrid-init-buffer nil 0 gamegrid-set-cell 1 2 snake-border snake-blank] 8])
(defalias 'snake-reset-game #[0 "\306 \210\307 \210\n\f\310
\311\310\211\310	\311\211W\203J\310\312#\210\313\"
B
\\\262
\\\262\210\211T\262\202!\266\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 snake-snake] 10])
(defalias 'snake-set-dot #[0 "\304!\304	!\305\"\nU\204\304!\262\304	!\262\202\306#\207" [snake-width snake-height snake-blank snake-dot random gamegrid-get-cell gamegrid-set-cell] 6])
#@150 Called on each clock tick.
Advances the snake one square, testing for collision.
Argument SNAKE-BUFFER is the name of the buffer.

(fn SNAKE-BUFFER)
(defalias 'snake-update-game #[257 "?\205up=\205u\306 \210	@\211\307H\n\\\310H\\\311\"\211\fU\204*\211
U\203-\312 \207\211U\203GTT\313 \210\314 \210\202b\315Z	\233\211A@\211\307H\310H\316#\210\317\241\266\316
#\210\320\"	B\317\211\266\204\207" [snake-paused snake-positions snake-velocity-x snake-velocity-y snake-border snake-snake snake-update-velocity 0 1 gamegrid-get-cell snake-end-game snake-update-score snake-set-dot 2 gamegrid-set-cell nil vector snake-dot snake-length snake-score snake-blank snake-moved-p] 13 (#$ . 6518)])
(defalias 'snake-update-velocity #[0 "?\205	\203\304	!@\211@\211A@	\237A\237\210\305\211\207" [snake-moved-p snake-velocity-queue snake-velocity-x snake-velocity-y last t] 2])
(defalias 'snake-final-x-velocity #[0 "@@\206	\207" [snake-velocity-queue snake-velocity-x] 1])
(defalias 'snake-final-y-velocity #[0 "@A@\206	\207" [snake-velocity-queue snake-velocity-y] 1])
#@27 Make the snake move left.
(defalias 'snake-move-left #[0 "\301 \302U\205\f\303B\211\207" [snake-velocity-queue snake-final-x-velocity 0 (-1 0)] 2 (#$ . 7630) [nil (snake-mode)]])
#@28 Make the snake move right.
(defalias 'snake-move-right #[0 "\301 \302U\205\f\303B\211\207" [snake-velocity-queue snake-final-x-velocity 0 (1 0)] 2 (#$ . 7818) [nil (snake-mode)]])
#@25 Make the snake move up.
(defalias 'snake-move-up #[0 "\301 \302U\205\f\303B\211\207" [snake-velocity-queue snake-final-y-velocity 0 (0 -1)] 2 (#$ . 8007) [nil (snake-mode)]])
#@27 Make the snake move down.
(defalias 'snake-move-down #[0 "\301 \302U\205\f\303B\211\207" [snake-velocity-queue snake-final-y-velocity 0 (0 1)] 2 (#$ . 8191) [nil (snake-mode)]])
#@29 Terminate the current game.
(defalias 'snake-end-game #[0 "\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 (#$ . 8378) [nil (snake-mode)]])
#@28 Start a new game of Snake.
(defalias 'snake-start-game #[0 "\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 (#$ . 8611) [nil (snake-mode)]])
#@37 Pause (or resume) the current game.
(defalias 'snake-pause-game #[0 "?\301\205	\302!\207" [snake-paused message "Game paused (press p to resume)"] 2 (#$ . 8876) [nil (snake-mode)]])
(defalias 'snake-active-p #[0 "\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 #[0 "\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\2035\211\321 =\203;\322\f\323 \"\210\210\324
\325\"\204R
!=\204R\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 snake-mode-abbrev-table 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 local-abbrev-table snake-null-map snake-use-glyphs-flag gamegrid-use-glyphs snake-use-color-flag gamegrid-use-color] 5 (#$ . 10317)])
#@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 #[0 "\301!\210\302 \210\303 \210\304 \207" [snake-buffer-name switch-to-buffer gamegrid-kill-timer snake-mode snake-start-game] 2 (#$ . 11492) nil])
(provide 'snake)

Youez - 2016 - github.com/yon3zu
LinuXploit