-;;; 5x5.el -- Simple little puzzle game.
+;;; 5x5.el --- simple little puzzle game
-;; Copyright (C) 1999,2000 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2000, 2002, 2003, 2004,
+;; 2005 Free Software Foundation, Inc.
;; Author: Dave Pearson <davep@davep.org>
;; Maintainer: Dave Pearson <davep@davep.org>
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
;;; Commentary:
;; Pascal Q. Porcupine <joshagam@cs.nmsu.edu> for inspiring the animated
;; solver.
+;;; Code:
+
;; Things we need.
(eval-when-compile
(define-key map [(control c) (control r)] #'5x5-crack-randomly)
(define-key map [(control c) (control c)] #'5x5-crack-mutating-current)
(define-key map [(control c) (control b)] #'5x5-crack-mutating-best)
- (define-key map [(control c) (control x)] #'5x5-crack-xor-mutate)
+ (define-key map [(control c) (control x)] #'5x5-crack-xor-mutate)
(define-key map "n" #'5x5-new-game)
(define-key map "q" #'5x5-quit-game)
(setq 5x5-mode-map map)))
(use-local-map 5x5-mode-map)
(setq major-mode '5x5-mode
mode-name "5x5")
- (run-hooks '5x5-mode-hook)
+ (run-mode-hooks '5x5-mode-hook)
(setq buffer-read-only t
truncate-lines t)
- (buffer-disable-undo (current-buffer)))
+ (buffer-disable-undo))
;;;###autoload
(defun 5x5 (&optional size)
5x5 keyboard bindings are:
\\<5x5-mode-map>
-Flip \\[5x5-flip-current]
-Move up \\[5x5-up]
-Move down \\[5x5-down]
-Move left \\[5x5-left]
-Move right \\[5x5-right]
+Flip \\[5x5-flip-current]
+Move up \\[5x5-up]
+Move down \\[5x5-down]
+Move left \\[5x5-left]
+Move right \\[5x5-right]
Start new game \\[5x5-new-game]
New game with random grid \\[5x5-randomize]
Random cracker \\[5x5-crack-randomly]
5x5-y-pos (/ 5x5-grid-size 2)
5x5-moves 0
5x5-grid (5x5-make-move (5x5-make-new-grid) 5x5-y-pos 5x5-x-pos))
- (when (interactive-p)
- (5x5-draw-grid (list 5x5-grid))
- (5x5-position-cursor))))
+ (5x5-draw-grid (list 5x5-grid))
+ (5x5-position-cursor)))
(defun 5x5-quit-game ()
"Quit the current game of `5x5'."
;;;###autoload
(defun 5x5-crack-xor-mutate ()
- "Attempt to crack 5x5 by xor the current and best solution and then
-mutating the result."
+ "Attempt to crack 5x5 by xor the current and best solution.
+Mutate the result."
(interactive)
(5x5-crack #'5x5-make-xor-with-mutation))
(5x5-position-cursor)
(sit-for 5x5-animate-delay))))
5x5-grid)
-
+
;; Keyboard response functions.
(defun 5x5-flip-current ()
(defun 5x5-xor (x y)
"Boolean exclusive-or of X and Y."
(and (or x y) (not (and x y))))
-
+
(defun 5x5-y-or-n-p (prompt)
"5x5 wrapper for y-or-n-p which respects the 5x5-hassle-me setting."
(if 5x5-hassle-me
(provide '5x5)
+;;; arch-tag: ec4dabd5-572d-41ea-b48c-ec5ce0d68fa9
;;; 5x5.el ends here