146 |
(define-key map [(control c) (control r)] #'5x5-crack-randomly) |
(define-key map [(control c) (control r)] #'5x5-crack-randomly) |
147 |
(define-key map [(control c) (control c)] #'5x5-crack-mutating-current) |
(define-key map [(control c) (control c)] #'5x5-crack-mutating-current) |
148 |
(define-key map [(control c) (control b)] #'5x5-crack-mutating-best) |
(define-key map [(control c) (control b)] #'5x5-crack-mutating-best) |
149 |
(define-key map [(control c) (control x)] #'5x5-crack-xor-mutate) |
(define-key map [(control c) (control x)] #'5x5-crack-xor-mutate) |
150 |
(define-key map "n" #'5x5-new-game) |
(define-key map "n" #'5x5-new-game) |
151 |
(define-key map "q" #'5x5-quit-game) |
(define-key map "q" #'5x5-quit-game) |
152 |
(setq 5x5-mode-map map))) |
(setq 5x5-mode-map map))) |
178 |
(use-local-map 5x5-mode-map) |
(use-local-map 5x5-mode-map) |
179 |
(setq major-mode '5x5-mode |
(setq major-mode '5x5-mode |
180 |
mode-name "5x5") |
mode-name "5x5") |
181 |
(run-hooks '5x5-mode-hook) |
(run-hooks '5x5-mode-hook) |
182 |
(setq buffer-read-only t |
(setq buffer-read-only t |
183 |
truncate-lines t) |
truncate-lines t) |
184 |
(buffer-disable-undo (current-buffer))) |
(buffer-disable-undo (current-buffer))) |
192 |
|
|
193 |
5x5 keyboard bindings are: |
5x5 keyboard bindings are: |
194 |
\\<5x5-mode-map> |
\\<5x5-mode-map> |
195 |
Flip \\[5x5-flip-current] |
Flip \\[5x5-flip-current] |
196 |
Move up \\[5x5-up] |
Move up \\[5x5-up] |
197 |
Move down \\[5x5-down] |
Move down \\[5x5-down] |
198 |
Move left \\[5x5-left] |
Move left \\[5x5-left] |
199 |
Move right \\[5x5-right] |
Move right \\[5x5-right] |
200 |
Start new game \\[5x5-new-game] |
Start new game \\[5x5-new-game] |
201 |
New game with random grid \\[5x5-randomize] |
New game with random grid \\[5x5-randomize] |
202 |
Random cracker \\[5x5-crack-randomly] |
Random cracker \\[5x5-crack-randomly] |
426 |
(5x5-position-cursor) |
(5x5-position-cursor) |
427 |
(sit-for 5x5-animate-delay)))) |
(sit-for 5x5-animate-delay)))) |
428 |
5x5-grid) |
5x5-grid) |
429 |
|
|
430 |
;; Keyboard response functions. |
;; Keyboard response functions. |
431 |
|
|
432 |
(defun 5x5-flip-current () |
(defun 5x5-flip-current () |
512 |
(defun 5x5-xor (x y) |
(defun 5x5-xor (x y) |
513 |
"Boolean exclusive-or of X and Y." |
"Boolean exclusive-or of X and Y." |
514 |
(and (or x y) (not (and x y)))) |
(and (or x y) (not (and x y)))) |
515 |
|
|
516 |
(defun 5x5-y-or-n-p (prompt) |
(defun 5x5-y-or-n-p (prompt) |
517 |
"5x5 wrapper for y-or-n-p which respects the 5x5-hassle-me setting." |
"5x5 wrapper for y-or-n-p which respects the 5x5-hassle-me setting." |
518 |
(if 5x5-hassle-me |
(if 5x5-hassle-me |