• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/emacs-92/emacs/lisp/play/

Lines Matching defs:bb

72 (defvar bb-board nil
75 (defvar bb-x -1
78 (defvar bb-y -1
81 (defvar bb-score 0
84 (defvar bb-detour-count 0
87 (defvar bb-balls-placed nil
102 (blackbox-redefine-key map 'backward-char 'bb-left)
103 (blackbox-redefine-key map 'forward-char 'bb-right)
104 (blackbox-redefine-key map 'previous-line 'bb-up)
105 (blackbox-redefine-key map 'next-line 'bb-down)
106 (blackbox-redefine-key map 'move-end-of-line 'bb-eol)
107 (blackbox-redefine-key map 'move-beginning-of-line 'bb-bol)
108 (define-key map " " 'bb-romp)
109 (define-key map [insert] 'bb-romp)
110 (blackbox-redefine-key map 'newline 'bb-done)
121 \\<blackbox-mode-map>\\[bb-bol] and \\[bb-eol] move to the beginning and end of line, respectively.
123 \\[bb-romp] -- send in a ray from point, or toggle a ball at point
124 \\[bb-done] -- end game and get score"
161 box and pressing \\[bb-romp].
164 press \\[bb-done]. You will be informed whether you are correct or
251 (setq bb-board (bb-init-board (or num 4)))
252 (setq bb-balls-placed nil)
253 (setq bb-x -1)
254 (setq bb-y -1)
255 (setq bb-score 0)
256 (setq bb-detour-count 0)
257 (bb-insert-board)
258 (bb-goto (cons bb-x bb-y)))
260 (defun bb-init-board (num-balls)
271 (defun bb-insert-board ()
279 (insert (format "\nThere are %d balls in the box" (length bb-board)))
282 (defun bb-right (count)
284 (while (and (> count 0) (< bb-x 8))
286 (setq bb-x (1+ bb-x))
289 (defun bb-left (count)
291 (while (and (> count 0) (> bb-x -1))
293 (setq bb-x (1- bb-x))
296 (defun bb-up (count)
298 (while (and (> count 0) (> bb-y -1))
300 (setq bb-y (1- bb-y))
303 (defun bb-down (count)
305 (while (and (> count 0) (< bb-y 8))
307 (setq bb-y (1+ bb-y))
310 (defun bb-eol ()
312 (setq bb-x 8)
313 (bb-goto (cons bb-x bb-y)))
315 (defun bb-bol ()
317 (setq bb-x -1)
318 (bb-goto (cons bb-x bb-y)))
320 (defun bb-romp ()
324 (or (= bb-x -1) (= bb-x 8))
325 (or (= bb-y -1) (= bb-y 8))))
326 ((bb-outside-box bb-x bb-y)
327 (bb-trace-ray bb-x bb-y))
329 (bb-place-ball bb-x bb-y))))
331 (defun bb-place-ball (x y)
334 ((member coord bb-balls-placed)
335 (setq bb-balls-placed (delete coord bb-balls-placed))
336 (bb-update-board "-"))
338 (setq bb-balls-placed (cons coord bb-balls-placed))
339 (bb-update-board (propertize "O" 'help-echo "Placed ball"))))))
341 (defun bb-trace-ray (x y)
343 (let ((result (bb-trace-ray-2
357 (bb-update-board (propertize "H" 'help-echo "Hit"))
358 (setq bb-score (1+ bb-score)))
360 (bb-update-board (propertize "R" 'help-echo "Reflection"))
361 (setq bb-score (1+ bb-score)))
363 (setq bb-detour-count (1+ bb-detour-count))
364 (bb-update-board (propertize (format "%d" bb-detour-count)
367 (bb-goto result)
368 (bb-update-board (propertize (format "%d" bb-detour-count)
370 (setq bb-score (+ bb-score 2)))))))
372 (defun bb-trace-ray-2 (first x dx y dy)
375 (bb-outside-box x y))
377 ((member (cons (+ x dx) (+ y dy)) bb-board)
379 ((member (cons (+ x dx dy) (+ y dy dx)) bb-board)
380 (bb-trace-ray-2 nil x (- dy) y (- dx)))
381 ((member (cons (+ x dx (- dy)) (+ y dy (- dx))) bb-board)
382 (bb-trace-ray-2 nil x dy y dx))
384 (bb-trace-ray-2 nil (+ x dx) dx (+ y dy) dy))))
386 (defun bb-done ()
391 ((not (= (length bb-balls-placed) (length bb-board)))
393 (if (= (length bb-board) 1) "is" "are")
394 (length bb-board)
395 (if (= (length bb-board) 1) "" "s")
396 (length bb-balls-placed)))
398 (setq bogus-balls (bb-show-bogus-balls bb-balls-placed bb-board))
400 (message "Right! Your score is %d." bb-score)
404 (+ bb-score (* 5 bogus-balls))))
405 (bb-goto '(-1 . -1))))))
407 (defun bb-show-bogus-balls (balls-placed board)
408 (bb-show-bogus-balls-2 balls-placed board "x")
409 (bb-show-bogus-balls-2 board balls-placed "o"))
411 (defun bb-show-bogus-balls-2 (list-1 list-2 c)
416 (bb-show-bogus-balls-2 (cdr list-1) list-2 c))
418 (bb-goto (car list-1))
419 (bb-update-board c)
420 (1+ (bb-show-bogus-balls-2 (cdr list-1) list-2 c)))))
422 (defun bb-outside-box (x y)
425 (defun bb-goto (pos)
428 (defun bb-update-board (c)