;ELC   
;;; Compiled by pot@pot.cnuce.cnr.it on Tue Mar 18 15:49:46 2003
;;; from file /home/pot/gnu/emacs-pretest.new/lisp/play/snake.el
;;; in Emacs version 21.3
;;; with bytecomp version 2.85.4.1
;;; with all optimizations.

;;; This file uses dynamic docstrings, first added in Emacs 19.29.
(if (and (boundp 'emacs-version)
	 (< (aref emacs-version (1- (length emacs-version))) ?A)
	 (or (and (boundp 'epoch::version) epoch::version)
	     (string-lessp emacs-version "19.29")))
    (error "`snake.el' was compiled for Emacs 19.29 or later"))

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


(require 'gamegrid)
#@42 Non-nil means use glyphs when available.
(defvar snake-use-glyphs t (#$ . 637))
#@41 Non-nil means use color when available.
(defvar snake-use-color t (#$ . 723))
#@29 Name used for Snake buffer.
(defvar snake-buffer-name "*Snake*" (#$ . 807))
#@34 Width of used portion of buffer.
(defvar snake-buffer-width 30 (#$ . 889))
#@35 Height of used portion of buffer.
(defvar snake-buffer-height 22 (#$ . 970))
#@24 Width of playing area.
(defvar snake-width 30 (#$ . 1053))
#@25 Height of playing area.
(defvar snake-height 20 (#$ . 1118))
#@26 Initial length of snake.
(defvar snake-initial-length 5 (#$ . 1185))
#@30 Initial X position of snake.
(defvar snake-initial-x 10 (#$ . 1260))
#@30 Initial Y position of snake.
(defvar snake-initial-y 10 (#$ . 1335))
#@30 Initial X velocity of snake.
(defvar snake-initial-velocity-x 1 (#$ . 1410))
#@30 Initial Y velocity of snake.
(defvar snake-initial-velocity-y 0 (#$ . 1493))
#@61 The default time taken for the snake to advance one square.
(defvar snake-tick-period 0.2 (#$ . 1576))
#@31 Hook run upon starting Snake.
(defvar snake-mode-hook nil (#$ . 1685))
#@22 X position of score.
(defvar snake-score-x 0 (#$ . 1762))
#@22 Y position of score.
(defvar snake-score-y snake-height (#$ . 1826))
#@31 File for holding high scores.
(defvar snake-score-file (concat temporary-file-directory "snake-scores") (#$ . 1901))
(byte-code "\301B\306\301!\204\f \307\302B\306\302!\204 \310\303B\306\303!\204$ \311\304B\306\304!\2040 \312\305B\306\305!\204< \313\314B\315\f\316B\317\320B\321\322B\323\324B\325\326B\306\326!\204l \315\327B\306\327!\204y \317\330B\306\330!\204\206 \315\331B\306\331!\204\223 \332\333B\306\333!\204\240 \315\334B\306\334!\204\255 \315\335B\306\335!\204\272 \332\336\326!\210\336\327!\210\336\330!\210\336\331!\210\336\333!\210\336\334!\210\336\335!\210\337B\306\337!\204\345 \340\337!\341\342\343#\210\341\344\345#\210\341\346\347#\210\341\350\351#\210\341\352\353#\210\341\354\355#\210\341\356\357#\210\360B\306\360!\204%\340\360!0\3410\342\343#\207" [current-load-list snake-blank-options snake-snake-options snake-dot-options snake-border-options snake-space-options boundp (((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"))) (((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"))) (((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"))) (((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"))) (((t 32)) nil nil) snake-blank 0 snake-snake 1 snake-dot 2 snake-border 3 snake-space 4 snake-length snake-velocity-x snake-velocity-y snake-positions nil snake-cycle snake-score snake-paused make-variable-buffer-local snake-mode-map make-sparse-keymap 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 snake-null-map] 4)
(defalias 'snake-display-options #[nil "\306\307\310\"\311\311\312X\203Q 	\211\nU\203 \202H 	\fU\203# \202H 	\fU\203/ \202H 	U\203; \202H 	U\203G \202H \313I\210	T\211\202 ))\207" [options c snake-blank snake-blank-options snake-snake snake-snake-options make-vector 256 nil 0 255 (nil nil nil) snake-dot snake-dot-options snake-border snake-border-options snake-space snake-space-options] 5])
(defalias 'snake-update-score #[nil "\306\307\"\211G\310\nS\fX\203% \311\\	H#\210T\211\202 ,\312\207" [snake-score string len x #1=#:G97269 snake-score-x format "Score:  %05d" 0 gamegrid-set-cell nil snake-score-y] 7])
(defalias 'snake-init-buffer #[nil "\306	\n#\210\307\310S\f\f\fX\203> \310SX\2036 \311\f#\210T\211\202 *\fT\211\202 *\312\313Z\fX\203w \312\313ZX\203o \311\f#\210T\211\202X *\fT\211\202G +\307\207" [snake-buffer-width snake-buffer-height snake-space buffer-read-only y snake-height gamegrid-init-buffer nil 0 gamegrid-set-cell 1 2 #1=#:G97270 x snake-width #2=#:G97272 snake-border #3=#:G97271 #4=#:G97273 snake-blank] 6])
(defalias 'snake-reset-game #[nil "\306 \210\307 \210\n\f\310\311\312\310	\312W\203W \313#\210\314\"B\\\\T\211\202( ,\315 \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 1 0 gamegrid-set-cell vector snake-update-score snake-positions snake-cycle snake-score snake-paused snake-initial-x snake-initial-y y x i #1=#:--dotimes-temp--97274 snake-snake] 5])
#@82 Called on each clock tick.
Advances the snake one square, testing for collision.
(defalias 'snake-update-game #[(snake-buffer) "?\205\236 p	=\205\236 \n@\211\306H\f\\\307H\\\310\"\211U\2042 U\2037 \311 \202\235 U\203O TT\312 \210\202\214 \313Z\n\233\211\211A@)\211\306H\307H\314\315\246\306U\203} \202 #\210T\316\241\210,\314#\210\317\"\nB\211,\207" [snake-paused snake-buffer snake-positions pos snake-velocity-x x 0 1 gamegrid-get-cell snake-end-game snake-update-score 2 gamegrid-set-cell 5 nil vector snake-velocity-y y c snake-border snake-snake snake-dot snake-length snake-score last-cons tail-pos x0 y0 snake-cycle snake-blank] 6 (#$ . 5548)])
#@27 Makes the snake move left
(defalias 'snake-move-left #[nil "\302U?\205\f \303\304\211\207" [snake-velocity-x snake-velocity-y 1 -1 0] 2 (#$ . 6276) nil])
#@28 Makes the snake move right
(defalias 'snake-move-right #[nil "\302U?\205\f \303\304\211\207" [snake-velocity-x snake-velocity-y -1 1 0] 2 (#$ . 6439) nil])
#@25 Makes the snake move up
(defalias 'snake-move-up #[nil "\302U?\205\f \303\304\211\207" [snake-velocity-y snake-velocity-x 1 0 -1] 2 (#$ . 6604) nil])
#@27 Makes the snake move down
(defalias 'snake-move-down #[nil "\302U?\205\f \303\304\211\207" [snake-velocity-y snake-velocity-x -1 0 1] 2 (#$ . 6763) nil])
#@29 Terminates 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 (#$ . 6926) nil])
#@28 Starts a new game of Snake
(defalias 'snake-start-game #[nil "\302 \210\303!\210\304	\305\"\207" [snake-mode-map snake-tick-period snake-reset-game use-local-map gamegrid-start-timer snake-update-game] 3 (#$ . 7146) nil])
#@38 Pauses (or resumes) the current game
(defalias 'snake-pause-game #[nil "?\301\205	 \302!\207" [snake-paused message "Game paused (press p to resume)"] 2 (#$ . 7375) nil])
(defalias 'snake-active-p #[nil "\301 =\207" [snake-mode-map current-local-map] 2])
(put 'snake-mode 'mode-class 'special)
#@74 A mode for playing Snake.

snake-mode keybindings:
   \{snake-mode-map}

(defalias 'snake-mode #[nil "\306 \210\307\310!\210\311\310\312\313\314$\210\315!\210\316\317\320\f\321\322 !\210\323\324!\207" [snake-null-map major-mode mode-name mode-popup-menu snake-use-glyphs gamegrid-use-glyphs kill-all-local-variables make-local-hook kill-buffer-hook add-hook gamegrid-kill-timer nil t use-local-map snake-mode "Snake" ("Snake Commands" ["Start new game" snake-start-game] ["End game" snake-end-game (snake-active-p)] ["Pause" snake-pause-game (and (snake-active-p) (not snake-paused))] ["Resume" snake-pause-game (and (snake-active-p) snake-paused)]) gamegrid-init snake-display-options run-hooks snake-mode-hook snake-use-color gamegrid-use-color] 5 (#$ . 7679)])
#@517 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 (#$ . 8459) nil])
(provide 'snake)
