(require 'cookie1)
; Variables
-(defvar bruce-phrases-file "~/bruce.lines"
- "Keep your favorite phrases here.")
-
-(defvar bruce-phrase-default-count 15
- "Default number of phrases to insert")
+(defgroup bruce nil
+ "Insert phrases selected at random from a file into a buffer."
+ :prefix "bruce-"
+ :group 'games)
+
+(defcustom bruce-phrases-file "~/bruce.lines"
+ "Keep your favorite phrases here."
+ :type 'file
+ :group 'bruce)
+
+(defcustom bruce-phrase-default-count 15
+ "Default number of phrases to insert."
+ :type 'integer
+ :group 'bruce)
;;;###autoload
(defun bruce ()
(eval-when-compile
(require 'cl))
-(defvar decipher-force-uppercase t
+(defgroup decipher nil
+ "Cryptanalyze monoalphabetic substitution ciphers."
+ :prefix "decipher-"
+ :group 'games)
+
+(defcustom decipher-force-uppercase t
"*Non-nil means to convert ciphertext to uppercase.
Nil means the case of the ciphertext is preserved.
-This variable must be set before typing `\\[decipher]'.")
+This variable must be set before typing `\\[decipher]'."
+ :type 'boolean
+ :group 'decipher)
+
-(defvar decipher-ignore-spaces nil
+(defcustom decipher-ignore-spaces nil
"*Non-nil means to ignore spaces and punctuation when counting digrams.
You should set this to `nil' if the cipher message is divided into words,
or `t' if it is not.
-This variable is buffer-local.")
+This variable is buffer-local."
+ :type 'boolean
+ :group 'decipher)
(make-variable-buffer-local 'decipher-ignore-spaces)
-(defvar decipher-undo-limit 5000
+(defcustom decipher-undo-limit 5000
"The maximum number of entries in the undo list.
When the undo list exceeds this number, 100 entries are deleted from
-the tail of the list.")
+the tail of the list."
+ :type 'integer
+ :group 'decipher)
+
+(defcustom decipher-mode-hook nil
+ "Hook to run upon entry to decipher."
+ :type 'hook
+ :group 'decipher)
;; End of user modifiable variables
;;--------------------------------------------------------------------
;;; The log file should be set for your system, and it must
;;; be writable by all.
-
-(defvar dun-log-file "/usr/local/dunnet.score"
- "Name of file to store score information for dunnet.")
+(defgroup dunnet nil
+ "Text adventure for Emacs."
+ :prefix "dun-"
+ :group 'games)
+
+(defcustom dun-log-file "/usr/local/dunnet.score"
+ "Name of file to store score information for dunnet."
+ :type 'file
+ :group 'dunnet)
(if nil
(eval-and-compile (setq byte-compile-warnings nil)))
;;;; Configuration variables
-(defvar gametree-half-ply-regexp (regexp-quote ":")
+(defgroup gametree nil
+ "Manage game analysis trees in Emacs."
+ :prefix "gametree-"
+ :group 'games)
+
+(defcustom gametree-half-ply-regexp (regexp-quote ":")
"*Matches ends of numbers of moves by the \"second\" player.
For instance, it is an almost universal convention in chess to postfix
numbers of moves by Black (if considered in isolation) by the ellipsis
\"...\". This is NOT a good choice for this program, though, because it
conflicts with the use of ellipsis by Outline mode to denote collapsed
subtrees. The author uses \":\" because it agrees nicely with a set of
-LaTeX macros he uses for typesetting annotated games.")
+LaTeX macros he uses for typesetting annotated games."
+ :type 'regexp
+ :group 'gametree)
-(defvar gametree-full-ply-regexp (regexp-quote ".")
+(defcustom gametree-full-ply-regexp (regexp-quote ".")
"*Matches ends of numbers of moves by the \"first\" player.
For instance, it is an almost universal convention in chess to postfix
-numbers of moves by White (if considered in isolation) by the dot \".\".")
+numbers of moves by White (if considered in isolation) by the dot \".\"."
+ :type 'regexp
+ :group 'gametree)
-(defvar gametree-half-ply-format "%d:"
+(defcustom gametree-half-ply-format "%d:"
"*Output format for move numbers of moves by the \"second\" player.
-Has to contain \"%d\" to output the actual number.")
+Has to contain \"%d\" to output the actual number."
+ :type 'string
+ :group 'gametree)
-(defvar gametree-full-ply-format "%d."
+(defcustom gametree-full-ply-format "%d."
"*Output format for move numbers of moves by the \"first\" player.
-Has to contain \"%d\" to output the actual number.")
+Has to contain \"%d\" to output the actual number."
+ :type 'string
+ :group 'gametree)
-(defvar gametree-make-heading-function
+(defcustom gametree-make-heading-function
(function (lambda (level)
(insert (make-string level ?*))))
"A function of one numeric argument, LEVEL, to insert a heading at point.
-You should change this if you change `outline-regexp'.")
+You should change this if you change `outline-regexp'."
+ :type 'function
+ :group 'gametree)
(defvar gametree-local-layout nil
"A list encoding the layout (i.e. the show or hide state) of the file.
;;; Code:
\f
+(defgroup gomoku nil
+ "Gomoku game between you and Emacs."
+ :prefix "gomoku-"
+ :group 'games)
;;;
;;; GOMOKU MODE AND KEYMAP.
;;;
-(defvar gomoku-mode-hook nil
- "If non-nil, its value is called on entry to Gomoku mode.")
+(defcustom gomoku-mode-hook nil
+ "If non-nil, its value is called on entry to Gomoku mode.
+One useful value to include is `turn-on-font-lock' to highlight the pieces."
+ :type 'hook
+ :group 'gomoku)
(defvar gomoku-mode-map nil
"Local keymap to use in Gomoku mode.")
gomoku-mode-map (current-global-map)))
(defvar gomoku-emacs-won ()
- "*For making font-lock use the winner's face for the line.")
+ "For making font-lock use the winner's face for the line.")
-(defvar gomoku-font-lock-O-face
+(defcustom gomoku-font-lock-O-face
(if window-system
(list (facemenu-get-face 'fg:red) 'bold))
- "*Face to use for Emacs' O.")
+ "*Face to use for Emacs' O."
+ :type '(repeat face)
+ :group 'gomoku)
-(defvar gomoku-font-lock-X-face
+(defcustom gomoku-font-lock-X-face
(if window-system
(list (facemenu-get-face 'fg:green) 'bold))
- "*Face to use for your X.")
+ "*Face to use for your X."
+ :type '(repeat face)
+ :group 'gomoku)
(defvar gomoku-font-lock-keywords
'(("O" . gomoku-font-lock-O-face)
;; Variables
+(defgroup handwrite nil
+ "Turns your emacs buffer into a handwritten document."
+ :prefix "handwrite-"
+ :group 'games)
+
(defvar handwrite-psindex 0
"The index of the PostScript buffer.")
(defvar menu-bar-handwrite-map (make-sparse-keymap "Handwrite functions."))
;; User definable variables
-(defvar handwrite-numlines 60
- "*The number of lines on a page of the PostScript output from `handwrite'.")
-(defvar handwrite-fontsize 11
- "*The size of the font for the PostScript output from `handwrite'.")
-(defvar handwrite-linespace 12
- "*The spacing for the PostScript output from `handwrite'.")
-(defvar handwrite-xstart 30
- "*X-axis translation in the PostScript output from `handwrite'.")
-(defvar handwrite-ystart 810
- "*Y-axis translation in the PostScript output from `handwrite'.")
-(defvar handwrite-pagenumbering nil
- "*If non-nil, number each page of the PostScript output from `handwrite'.")
-(defvar handwrite-10pt-numlines 65
- "*The number of lines on a page for the function `handwrite-10pt'.")
-(defvar handwrite-11pt-numlines 60
- "*The number of lines on a page for the function `handwrite-11pt'.")
-(defvar handwrite-12pt-numlines 55
- "*The number of lines on a page for the function `handwrite-12pt'.")
-(defvar handwrite-13pt-numlines 50
- "*The number of lines on a page for the function `handwrite-13pt'.")
-
+(defcustom handwrite-numlines 60
+ "*The number of lines on a page of the PostScript output from `handwrite'."
+ :type 'integer
+ :group 'handwrite)
+(defcustom handwrite-fontsize 11
+ "*The size of the font for the PostScript output from `handwrite'."
+ :type 'integer
+ :group 'handwrite)
+(defcustom handwrite-linespace 12
+ "*The spacing for the PostScript output from `handwrite'."
+ :type 'integer
+ :group 'handwrite)
+(defcustom handwrite-xstart 30
+ "*X-axis translation in the PostScript output from `handwrite'."
+ :type 'integer
+ :group 'handwrite)
+(defcustom handwrite-ystart 810
+ "*Y-axis translation in the PostScript output from `handwrite'."
+ :type 'integer
+ :group 'handwrite)
+(defcustom handwrite-pagenumbering nil
+ "*If non-nil, number each page of the PostScript output from `handwrite'."
+ :type 'boolean
+ :group 'handwrite)
+(defcustom handwrite-10pt-numlines 65
+ "*The number of lines on a page for the function `handwrite-10pt'."
+ :type 'integer
+ :group 'handwrite)
+(defcustom handwrite-11pt-numlines 60
+ "*The number of lines on a page for the function `handwrite-11pt'."
+ :type 'integer
+ :group 'handwrite)
+(defcustom handwrite-12pt-numlines 55
+ "*The number of lines on a page for the function `handwrite-12pt'."
+ :type 'integer
+ :group 'handwrite)
+(defcustom handwrite-13pt-numlines 50
+ "*The number of lines on a page for the function `handwrite-13pt'."
+ :type 'integer
+ :group 'handwrite)
;; Interactive functions
;;;_* From Gomoku
+(defgroup lm nil
+ "Neural-network robot that learns landmarks."
+ :prefix "lm-"
+ :group 'games)
+
;;;_ + THE BOARD.
;; The board is a rectangular grid. We code empty squares with 0, X's with 1
;;;_ + LM MODE AND KEYMAP.
-(defvar lm-mode-hook nil
- "If non-nil, its value is called on entry to Lm mode.")
+(defcustom lm-mode-hook nil
+ "If non-nil, its value is called on entry to Lm mode."
+ :type 'hook
+ :group 'lm)
(defvar lm-mode-map nil
"Local keymap to use in Lm mode.")
;;;(setq lm-debug nil)
(defvar lm-debug nil
"If non-nil, debugging is printed.")
-(defvar lm-one-moment-please nil
+(defcustom lm-one-moment-please nil
"If non-nil, print \"One moment please\" when a new board is generated.
The drawback of this is you don't see how many moves the last run took
-because it is overwritten by \"One moment please\".")
-(defvar lm-output-moves t
- "If non-nil, output number of moves so far on a move-by-move basis.")
+because it is overwritten by \"One moment please\"."
+ :type 'boolean
+ :group 'lm)
+(defcustom lm-output-moves t
+ "If non-nil, output number of moves so far on a move-by-move basis."
+ :type 'boolean
+ :group 'lm)
(defun lm-weights-debug ()
(mapc 'lm-print-wts-int lm-directions))
;;;_ - learning parameters
-(defvar lm-bound 0.005
- "The maximum that w0j may be.")
-(defvar lm-c 1.0
+(defcustom lm-bound 0.005
+ "The maximum that w0j may be."
+ :type 'number
+ :group 'lm)
+(defcustom lm-c 1.0
"A factor applied to modulate the increase in wij.
-Used in the function lm-update-normal-weights.")
-(defvar lm-c-naught 0.5
+Used in the function lm-update-normal-weights."
+ :type 'number
+ :group 'lm)
+(defcustom lm-c-naught 0.5
"A factor applied to modulate the increase in w0j.
-Used in the function lm-update-naught-weights.")
+Used in the function lm-update-naught-weights."
+ :type 'number
+ :group 'lm)
(defvar lm-initial-w0 0.0)
(defvar lm-initial-wij 0.0)
-(defvar lm-no-payoff 0
+(defcustom lm-no-payoff 0
"The amount of simulation cycles that have occurred with no movement.
-Used to move the robot when he is stuck in a rut for some reason.")
-(defvar lm-max-stall-time 2
+Used to move the robot when he is stuck in a rut for some reason."
+ :type 'integer
+ :group 'lm)
+(defcustom lm-max-stall-time 2
"The maximum number of cycles that the robot can remain stuck in a place.
-After this limit is reached, lm-random-move is called to push him out of it.")
+After this limit is reached, lm-random-move is called to push him out of it."
+ :type 'integer
+ :group 'lm)
;;;_ + Randomizing functions
;;; Code:
+(defgroup mpuz nil
+ "Multiplication puzzle."
+ :prefix "mpuz-"
+ :group 'games)
+
(random t) ; randomize
-(defvar mpuz-silent nil
- "*Set this to T if you don't want dings on inputs.")
+(defcustom mpuz-silent nil
+ "*Set this to T if you don't want dings on inputs."
+ :type 'boolean
+ :group 'mpuz)
(defun mpuz-ding ()
"Dings, unless global variable `mpuz-silent' forbids it."
\f
;; Mpuz mode and keymaps
;;----------------------
-(defvar mpuz-mode-hook nil)
+(defcustom mpuz-mode-hook nil
+ "Hook to run upon entry to mpuz."
+ :type 'hook
+ :group 'mpuz)
(defvar mpuz-mode-map nil
"Local keymap to use in Mult Puzzle.")
;;; Code:
+(defgroup solitaire nil
+ "Game of solitaire."
+ :prefix "solitaire-"
+ :group 'games)
+
(defvar solitaire-mode-map nil
"Keymap for playing solitaire.")
+(defcustom solitaire-mode-hook nil
+ "Hook to run upon entry to solitaire."
+ :type 'hook
+ :group 'solitaire)
+
(if solitaire-mode-map
()
(setq solitaire-mode-map (make-sparse-keymap))
(defvar solitaire-end-x nil)
(defvar solitaire-end-y nil)
-(defvar solitaire-auto-eval t
+(defcustom solitaire-auto-eval t
"*Non-nil means check for possible moves after each major change.
This takes a while, so switch this on if you like to be informed when
-the game is over, or off, if you are working on a slow machine.")
+the game is over, or off, if you are working on a slow machine."
+ :type 'boolean
+ :group 'solitaire)
(defconst solitaire-valid-directions
'(solitaire-left solitaire-right solitaire-up solitaire-down))
Move stones using \\[solitaire-move] followed by a direction key.
Undo moves using \\[solitaire-undo].
Check for possible moves using \\[solitaire-do-check].
-\(The variable solitaire-auto-eval controls whether to automatically
+\(The variable `solitaire-auto-eval' controls whether to automatically
check after each move or undo)
What is Solitaire?
(require 'cookie1)
; Variables
-(defvar spook-phrases-file (concat data-directory "spook.lines")
- "Keep your favorite phrases here.")
-
-(defvar spook-phrase-default-count 15
- "Default number of phrases to insert")
+(defgroup spook nil
+ "Spook phrase utility for overloading the NSA line eater."
+ :prefix "spook-"
+ :group 'games)
+
+(defcustom spook-phrases-file (concat data-directory "spook.lines")
+ "Keep your favorite phrases here."
+ :type 'file
+ :group 'spook)
+
+(defcustom spook-phrase-default-count 15
+ "Default number of phrases to insert."
+ :type 'integer
+ :group 'spook)
;;;###autoload
(defun spook ()
(require 'cookie1)
-(defvar yow-file (concat data-directory "yow.lines")
- "File containing pertinent pinhead phrases.")
+(defgroup yow nil
+ "Quote random zippyisms."
+ :prefix "yow-"
+ :group 'games)
+
+(defcustom yow-file (concat data-directory "yow.lines")
+ "File containing pertinent pinhead phrases."
+ :type 'file
+ :group 'yow)
(defconst yow-load-message "Am I CONSING yet?...")
(defconst yow-after-load-message "I have SEEN the CONSING!!")