Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
18a6a207
Commit
18a6a207
authored
Sep 08, 2004
by
Thien-Thi Nguyen
Browse files
(bb-trace-ray): Avoid double tracing.
parent
c2fb92d8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
28 deletions
+29
-28
lisp/play/blackbox.el
lisp/play/blackbox.el
+29
-28
No files found.
lisp/play/blackbox.el
View file @
18a6a207
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment