MMCT TEAM
Server IP : 111.118.215.189  /  Your IP : 3.128.31.200
Web Server : Apache
System : Linux md-in-83.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : a1673wkz ( 2475)
PHP Version : 8.2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /usr/share/emacs/24.3/lisp/play/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : //usr/share/emacs/24.3/lisp/play/pong.elc
;ELC
;;; Compiled by mockbuild@buildfarm06-new.corp.cloudlinux.com on Fri Oct 11 10:06:36 2024
;;; from file /builddir/build/BUILD/emacs-24.3/lisp/play/pong.el
;;; in Emacs version 24.3.1
;;; 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\321\322\310\303\316\323&\210\312\324\325\326\310\303\316\327&\210\312\330\331\332\310\303\316\333&\210\312\334\335\336\310\303\316\337&\210\312\340\341\342\310\303\316\337&\210\312\343\344\345\310\303\316\337&\210\312\346\347\350\310\303\316\337&\210\312\351\352\353\310\303\316\354&\210\312\355\356\357\310\303\316\360&\210\312\361\362\363\310\303\316\364&\210\312\365\366\367\310\303\316\370&\210\312\371\372\373\310\303\316\374&\210\312\375\376\377\310\303\316\201@&\210\312\201A\376\201B\310\303\316\201C&\210\312\201D\201E\201F\310\303\316\201G&\207" [require gamegrid custom-declare-group pong nil "Emacs-Lisp implementation of the classical game pong." :tag "Pong" :group games custom-declare-variable pong-buffer-name "*Pong*" "Name of the buffer used to play." :type (string) pong-width 50 "Width of the playfield." (integer) pong-height (min 30 (- (frame-height) 6)) "Height of the playfield." (integer) pong-bat-width 3 "Width of the bats for pong." (integer) pong-blank-color "black" "Color used for background." color pong-bat-color "yellow" "Color used for bats." pong-ball-color "red" "Color used for the ball." pong-border-color "white" "Color used for pong borders." pong-left-key "4" "Alternate key to press for bat 1 to go up (primary one is [left])." (restricted-sexp :match-alternatives (stringp vectorp)) pong-right-key "6" "Alternate key to press for bat 1 to go down (primary one is [right])." (restricted-sexp :match-alternatives (stringp vectorp)) pong-up-key "8" "Alternate key to press for bat 2 to go up (primary one is [up])." (restricted-sexp :match-alternatives (stringp vectorp)) pong-down-key "2" "Alternate key to press for bat 2 to go down (primary one is [down])." (restricted-sexp :match-alternatives (stringp vectorp)) pong-quit-key "q" "Key to press to quit pong." (restricted-sexp :match-alternatives (stringp vectorp)) pong-pause-key "p" "Key to press to pause pong." (restricted-sexp :match-alternatives (stringp vectorp)) pong-resume-key "Key to press to resume pong." (restricted-sexp :match-alternatives (stringp vectorp)) pong-timer-delay 0.1 "Time to wait between every cycle." number] 8)
(defvar pong-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 pong-blank-color))))
(defvar pong-bat-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 pong-bat-color))))
(defvar pong-ball-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 pong-ball-color))))
(defvar pong-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 pong-border-color))))
(defconst pong-blank 0)
(defconst pong-bat 1)
(defconst pong-ball 2)
(defconst pong-border 3)
#@31 Horizontal speed of the ball.
(defvar pong-xx nil (#$ . 3641))
#@29 Vertical speed of the ball.
(defvar pong-yy nil (#$ . 3710))
#@34 Horizontal position of the ball.
(defvar pong-x nil (#$ . 3777))
#@32 Vertical position of the ball.
(defvar pong-y nil (#$ . 3848))
#@29 Vertical position of bat 1.
(defvar pong-bat-player1 nil (#$ . 3917))
#@29 Vertical position of bat 2.
(defvar pong-bat-player2 nil (#$ . 3993))
(defvar pong-score-player1 nil)
(defvar pong-score-player2 nil)
#@24 Modemap for pong-mode.
(defvar pong-mode-map (byte-code "\306\307!\310\311\312#\210\310\313\314#\210\310\315\316#\210\310\317\320#\210\310	\312#\210\310\n\314#\210\310\316#\210\310\f\320#\210\310
\321#\210\310\322#\210)\207" [map pong-left-key pong-right-key pong-up-key pong-down-key pong-quit-key make-sparse-keymap pong-mode-map define-key [left] pong-move-left [right] pong-move-right [up] pong-move-up [down] pong-move-down pong-quit pong-pause pong-pause-key] 4) (#$ . 4133))
#@25 Null map for pong-mode.
(defvar pong-null-map (make-sparse-keymap 'pong-null-map) (#$ . 4636))
#@61 Computes display options (required by gamegrid for colors).
(defalias 'pong-display-options #[nil "\306\307\310\"\307\311	\nW\203H	\211U\203\f\202?	
U\203&\202?	\fU\2032
\202?	U\203>\202?\312I\210	T\211\202\n*)\207" [options c --dotimes-limit-- pong-blank pong-blank-options pong-bat make-vector 256 nil 0 (nil nil nil) pong-bat-options pong-ball pong-ball-options pong-border pong-border-options] 5 (#$ . 4737)])
#@67 Initialize pong buffer and draw stuff thanks to gamegrid library.
(defalias 'pong-init-buffer #[nil "\306!\210\307!\210\310	!\210\311\211\312\313 !\210\314\f\315
\\\316#\210\317
\320W\203X\f\320W\203N\321#\210T\211\2026*T\211\202(*\322
\315ZX\203\225\322\f\315ZX\203\213\321#\210T\211\202s*T\211\202c+\\SX\203\273\321\315#\210T\211\202\244*  \\S!!X\203\343\321\f\323Z#\210T\211\202\312*\317\207" [pong-buffer-name pong-mode-map gamegrid-use-glyphs gamegrid-use-color pong-width pong-height get-buffer-create switch-to-buffer use-local-map t gamegrid-init pong-display-options gamegrid-init-buffer 2 32 nil 0 gamegrid-set-cell 1 3 buffer-read-only y --dotimes-limit-- x pong-border #1=#:--cl-var-- #2=#:--cl-var-- pong-blank pong-bat-player1 pong-bat-width #3=#:--cl-var-- pong-bat pong-bat-player2 #4=#:--cl-var--] 5 (#$ . 5183) nil])
#@128 Move bat 2 up.
This is called left for historical reasons, since in some pong
implementations you move with left/right paddle.
(defalias 'pong-move-left #[nil "\301V\205S\211\205\302\303\"\207" [pong-bat-player1 1 pong-update-bat 2] 3 (#$ . 6143) nil])
#@16 Move bat 2 up.
(defalias 'pong-move-right #[nil "	\\\nSW\205T\211\205\303\304\"\207" [pong-bat-player1 pong-bat-width pong-height pong-update-bat 2] 3 (#$ . 6410) nil])
#@16 Move bat 2 up.
(defalias 'pong-move-up #[nil "\302V\205S\211\205\303	\304Z\"\207" [pong-bat-player2 pong-width 1 pong-update-bat 3] 3 (#$ . 6593) nil])
#@18 Move bat 2 down.
(defalias 'pong-move-down #[nil "	\\\nSW\205T\211\205\304\305Z\"\207" [pong-bat-player2 pong-bat-width pong-height pong-width pong-update-bat 3] 3 (#$ . 6759) nil])
#@70 Move a bat (suppress a cell and draw another one on the other side).
(defalias 'pong-update-bat #[(x y) "\306p!\230\2055\307	\n#\210\307	\n\f\\S#\210\n\310V\203$\307	\nS
#\210\n\f\\	SW\2055\307	\n\f\\
#\207" [pong-buffer-name x y pong-bat pong-bat-width pong-blank buffer-name gamegrid-set-cell 1 pong-height] 4 (#$ . 6956)])
#@20 Initialize a game.
(defalias 'pong-init #[nil "\306	\307#\210\310\311\312\313\314$\210\nZ\315\245T\211\316\317\315\245\n\315\245\320 \210\321 \210\322\323\"\210\324 \207" [pong-mode-map pong-pause-key pong-height pong-bat-width pong-bat-player1 pong-bat-player2 define-key pong-pause add-hook kill-buffer-hook pong-quit nil t 2 -1 0 pong-init-buffer gamegrid-kill-timer gamegrid-start-timer pong-update-game pong-update-score pong-xx pong-yy pong-width pong-x pong-y pong-timer-delay] 6 (#$ . 7295)])
#@181 "Main" function for pong.
It is called every pong-cycle-delay seconds and
updates ball and bats positions.  It is responsible of collision
detection and checks if a player scores.
(defalias 'pong-update-game #[(pong-buffer) "p=\204	\306 \207	\n	
\\\n\\\307V\203+SW\203+\310\f#\210\n\307V\203@\nSW\203@\310	\n#\210	\311U\204L	\312U\203\205\nY\205\n\\W\205\nU\203j\313\202w\nTU\203v\307\202w\314\\\211\205
[\211\202	\315ZU\204\227	\311ZU\203\320\nY\205\n\\W\205\nU\203\265\313\202\302\nTU\203\301\307\202\302\314\\\211\205
[\211\202\n\314X\203\337[\211\202\n\312ZY\203\361[\211\202	\314W\203T\316 \202	SY\205T\316 *\207" [pong-buffer pong-x pong-y old-y old-x pong-xx pong-pause 0 gamegrid-set-cell 3 2 -1 1 4 pong-init pong-yy pong-height pong-blank pong-ball pong-bat-player1 pong-bat-width pong-width pong-bat-player2 pong-score-player2 pong-score-player1] 4 (#$ . 7819)])
#@55 Update score and print it on bottom of the game grid.
(defalias 'pong-update-score #[nil "\306\307	#\211G\211\310\f
W\205,\311p!\230\203%\312\f\f\n\fH#\210\fT\211\202,\207" [pong-score-player1 pong-score-player2 string len x --dotimes-limit-- format "Score:  %d / %d" 0 buffer-name gamegrid-set-cell pong-buffer-name pong-height] 6 (#$ . 8816)])
#@17 Pause the game.
(defalias 'pong-pause #[nil "\302 \210\303\304!\210\305	\306#\207" [pong-mode-map pong-resume-key gamegrid-kill-timer cancel-function-timers pong-update-game define-key pong-resume] 4 (#$ . 9181) nil])
#@23 Resume a paused game.
(defalias 'pong-resume #[nil "\303	\304#\210\305\n\306\"\207" [pong-mode-map pong-pause-key pong-timer-delay define-key pong-pause gamegrid-start-timer pong-update-game] 4 (#$ . 9406) nil])
#@41 Quit the game and kill the pong buffer.
(defalias 'pong-quit #[nil "\302 \210\303\304\305	$\207" [pong-timer-delay pong-buffer-name gamegrid-kill-timer run-with-timer nil kill-buffer] 5 (#$ . 9625) nil])
#@209 Play pong and waste time.
This is an implementation of the classical game pong.
Move left and right bats and try to bounce the ball to your opponent.

pong-mode keybindings:\<pong-mode-map>

\{pong-mode-map}
(defalias 'pong #[nil "\302\211\303 \207" [pong-score-player1 pong-score-player2 0 pong-init] 2 (#$ . 9837) nil])
(provide 'pong)

MMCT - 2023