4.4BSD/usr/src/contrib/emacs-18.57/lisp/life.elc


(provide (quote life))

(defconst life-patterns [("@@@" " @@" "@@@") ("@@@ @@@" "@@  @@ " "@@@ @@@") ("@@@ @@@" "@@   @@" "@@@ @@@") ("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@") ("@@@@@@@@@@") ("   @@@@@@@@@@       " "     @@@@@@@@@@     " "       @@@@@@@@@@   " "@@@@@@@@@@          " "@@@@@@@@@@          ") ("@" "@" "@" "@" "@" "@" "@" "@" "@" "@" "@" "@" "@" "@" "@") ("@               @" "@               @" "@               @" "@               @" "@               @" "@               @" "@               @" "@               @" "@               @" "@               @" "@               @" "@               @" "@               @" "@               @" "@               @") ("@@               " " @@              " "  @@             " "   @@            " "    @@           " "     @@          " "      @@         " "       @@        " "        @@       " "         @@      " "          @@     " "           @@    " "            @@   " "             @@  " "              @@ " "               @@") ("@@@@@@@@@" "@   @   @" "@ @@@@@ @" "@ @   @ @" "@@@   @@@" "@ @   @ @" "@ @@@@@ @" "@   @   @" "@@@@@@@@@")] "\
Vector of rectangles containing some Life startup patterns.")

(require (progn (defmacro life-life-char nil 64) (defmacro life-death-char nil (1+ (life-life-char))) (defmacro life-birth-char nil 3) (defmacro life-void-char nil 32) (defmacro life-life-string nil (char-to-string (life-life-char))) (defmacro life-death-string nil (char-to-string (life-death-char))) (defmacro life-birth-string nil (char-to-string (life-birth-char))) (defmacro life-void-string nil (char-to-string (life-void-char))) (defmacro life-not-void-regexp nil (concat "[^" (life-void-string) "
]")) (defmacro goto-beginning-of-buffer nil (quote (goto-char 1))) (defmacro maxint nil (lsh (lsh (lognot 0) 1) -1)) (defmacro goto-end-of-buffer nil (quote (goto-char (maxint)))) (defmacro increment (variable) (list (quote setq) variable (list (quote 1+) variable))) (quote life)))

(defconst life-neighbor-deltas nil)

(defconst life-window-start nil)

(defconst life-current-generation nil)

(defconst life-generation-string nil)

(defun abs (n) (byte-code "ÁWƒ[‚‡" [n 0] 2))

(defun life (&optional sleeptime) "\
Run Conway's Life simulation.
The starting pattern is randomly selected.  Prefix arg (optional first arg
non-nil from a program) is the number of seconds to sleep between
generations (this defaults to 1)." (interactive "p") (byte-code "Ȇ	ĉˆÅ ˆÆ!ˆÁ…(ÁÇ ˆÈ ˆÉ ˆÆ!)ˆ‚‡" [sleeptime t inhibit-quit nil 1 life-setup life-display-generation life-grim-reaper life-expand-plane-if-needed life-increment-generation] 8))

(fset (quote life-mode) (quote life))

(put (quote life-mode) (quote mode-class) (quote special))

(random t)

(defun life-setup nil (byte-code "ÃÌÍÎ!Á\"ˆÏ ˆÐ ˆÃÑÒÁÓÔÕ	Ö S
׉ˆØp!ˆÙ ˆ×bˆÚÛÃÁ#…FÜÝÁÁ#ˆ‚5ˆ×bˆÞ
Šß ˆ`)Zà\"‰ˆm?…gjˆá ˆ‚YˆÞâ Sãed\"Zà\"‰ˆ×bˆä!ˆåbˆä!ˆ×bˆm?…¦ß ˆ
jˆæ
!ˆç`ß ˆ`\"ˆá ˆ‚‡ˆèed\"ˆé ˆê )‡" [n t case-fold-search nil mode-name major-mode truncate-lines life-current-generation life-generation-string mode-line-buffer-identification fill-column life-window-start switch-to-buffer get-buffer-create "*Life*" erase-buffer kill-all-local-variables "Life" life-mode 0 "0" ("Life: generation " life-generation-string) window-width 1 buffer-flush-undo life-insert-random-pattern re-search-forward "[^ 
]" replace-match "@" / end-of-line 2 forward-line window-height count-lines newline 8388607 move-to-column delete-region untabify life-expand-plane-if-needed life-compute-neighbor-deltas] 26))

(defun life-compute-neighbor-deltas nil (byte-code "ÂÃ	[	T[Ä	\\[Å		TÄ	\\&‰‡" [life-neighbor-deltas fill-column list -1 2 1] 10))

(defun life-insert-random-pattern nil (byte-code "ÁÂÃÄÅ !G\"\"!ˆÆc‡" [life-patterns insert-rectangle elt % abs random 10] 8))

(defun life-increment-generation nil (byte-code "T‰ˆÂ!‰‡" [life-current-generation life-generation-string int-to-string] 3))

(defun life-grim-reaper nil (byte-code "ÈÀ!ˆÉbˆÀÀÀÀÀÊËÀÆ#…�Ì`S‰ˆ
…x
@\\	f‰ˆ
Í=ƒBÎ		TÍÉÆ%‚o
ÏWƒTÎ		T

TÆ%‚o
ÐWƒeÎ		T
ÐÆ%‚o
ÑY…oT‰ˆ
A‰ˆ‚#ˆÒ>ƒƒÀ‚‹ÎTÑÓÆ%ˆ‚-ˆÔÌ!?…šÕ ˆÎÉdÐÍÆ%ˆÎÉdÉÍÆ%ˆÎÉdÖÍÆ%ˆÎÉdÏÑÆ%ˆÎÉdÓÍÆ%‡" [nil point char pivot living-neighbors list t life-neighbor-deltas store-match-data 1 search-forward "@" 0 32 subst-char-in-region 3 9 64 (2 3) 65 match-beginning life-extinct-quit 2] 18))

(defun life-expand-plane-if-needed nil (byte-code "ÃÄ�ˆÅbˆÆÇÈ`É$Á#….ÅbˆÊË\"ˆÌcˆÊË\"ˆÌcˆÈ
Å#‰ˆÍbˆÎÇÏ`É$Á#…YÍbˆÊË\"ˆÌcˆÊË\"ˆÌcˆÈ
Å#‰‡" [fill-column t life-window-start done (byte-code "Âbˆm?…GgÃ=†Ä ˆhÃ=…@Âbˆm?….ÅcˆÄ ˆÅcˆÆ ˆ‚ˆÇ\\‰ˆÈÂ!ˆÉ ˆÊËÁ\"ˆÌ ˆ‚‡" [fill-column t 1 64 end-of-line 32 forward-char 2 scroll-left life-compute-neighbor-deltas throw done forward-line] 9) 1 search-forward "@" + 2 insert-char 32 10 8388607 search-backward -] 13))

(defun life-display-generation (sleeptime) (byte-code "bˆÂÃ!ˆÄ	!‡" [life-window-start sleeptime recenter 0 sit-for] 3))

(defun life-extinct-quit nil (byte-code "ÁÂ!ˆÃÄÀ\"‡" [nil life-display-generation 0 signal life-extinct] 4))

(put (quote life-extinct) (quote error-conditions) (quote (life-extinct quit)))

(put (quote life-extinct) (quote error-message) "All life has perished")