Page 301 | Table of Contents | Index | Page 303 |
Chapters | |||
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30 A, B, C, D, E |
(define-application-frame puzzle () ((puzzle-array :initform (make-array '(4 4)))) (:menu-bar t) (:panes (display (outlining () (make-pane 'application-pane :text-cursor nil :width :compute :height :compute :incremental-redisplay T :display-function 'draw-puzzle)))) (:layout (:default display))) (defmethod run-frame-top-level :before ((puzzle puzzle)) ;; Initialize the puzzle ...) (define-presentation-type puzzle-cell () :inherit-from '(integer 1 15)) (defmethod draw-puzzle ((puzzle puzzle) stream &key max-width max-height) (declare (ignore max-width max-height)) ;; Draw the puzzle, presenting each cell as a PUZZLE-CELL ...) (define-puzzle-command com-move-cell ((cell 'puzzle-cell :gesture :select)) ;; Move the selected cell to the adjacent open cell, ;; if there is one ...) (define-puzzle-command (com-scramble :menu t) () ;; Scramble the pieces of the puzzle ...) (define-puzzle-command (com-exit-puzzle :menu "Exit") () (frame-exit *application-frame*)) (defun puzzle () (let ((puzzle
Page 301 | Table of Contents | Index | Page 303 |
Chapters | |||
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30 A, B, C, D, E |