diff options
author | Thien-Thi Nguyen <ttn@gnuvola.org> | 2004-09-08 10:07:38 +0000 |
---|---|---|
committer | Thien-Thi Nguyen <ttn@gnuvola.org> | 2004-09-08 10:07:38 +0000 |
commit | 18a6a2078320c56710beefd3245969527e3fe1de (patch) | |
tree | 1a7130e448cf8677cebe93cb3b7e7081bdcd6b9e /lisp/play/blackbox.el | |
parent | c2fb92d89a089dce36f52163351834f1c815146b (diff) | |
download | emacs-18a6a2078320c56710beefd3245969527e3fe1de.tar.gz |
(bb-trace-ray): Avoid double tracing.
Diffstat (limited to 'lisp/play/blackbox.el')
-rw-r--r-- | lisp/play/blackbox.el | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/lisp/play/blackbox.el b/lisp/play/blackbox.el index f3933e7ccd2..4d6cbfbeaf8 100644 --- a/lisp/play/blackbox.el +++ b/lisp/play/blackbox.el @@ -335,34 +335,35 @@ a reflection." (bb-update-board (propertize "O" 'help-echo "Placed ball")))))) (defun bb-trace-ray (x y) - (let ((result (bb-trace-ray-2 - t - x - (cond - ((= x -1) 1) - ((= x 8) -1) - (t 0)) - y - (cond - ((= y -1) 1) - ((= y 8) -1) - (t 0))))) - (cond - ((eq result 'hit) - (bb-update-board (propertize "H" 'help-echo "Hit")) - (setq bb-score (1+ bb-score))) - ((equal result (cons x y)) - (bb-update-board (propertize "R" 'help-echo "Reflection")) - (setq bb-score (1+ bb-score))) - (t - (setq bb-detour-count (1+ bb-detour-count)) - (bb-update-board (propertize (format "%d" bb-detour-count) - 'help-echo "Detour")) - (save-excursion - (bb-goto result) - (bb-update-board (propertize (format "%d" bb-detour-count) - 'help-echo "Detour"))) - (setq bb-score (+ bb-score 2)))))) + (when (= (following-char) 32) + (let ((result (bb-trace-ray-2 + t + x + (cond + ((= x -1) 1) + ((= x 8) -1) + (t 0)) + y + (cond + ((= y -1) 1) + ((= y 8) -1) + (t 0))))) + (cond + ((eq result 'hit) + (bb-update-board (propertize "H" 'help-echo "Hit")) + (setq bb-score (1+ bb-score))) + ((equal result (cons x y)) + (bb-update-board (propertize "R" 'help-echo "Reflection")) + (setq bb-score (1+ bb-score))) + (t + (setq bb-detour-count (1+ bb-detour-count)) + (bb-update-board (propertize (format "%d" bb-detour-count) + 'help-echo "Detour")) + (save-excursion + (bb-goto result) + (bb-update-board (propertize (format "%d" bb-detour-count) + 'help-echo "Detour"))) + (setq bb-score (+ bb-score 2))))))) (defun bb-trace-ray-2 (first x dx y dy) (cond |