
(defvar blackbox-mode-map nil "\
")

(if blackbox-mode-map nil (setq blackbox-mode-map (make-keymap)) (suppress-keymap blackbox-mode-map t) (define-key blackbox-mode-map "" (quote bb-right)) (define-key blackbox-mode-map "" (quote bb-left)) (define-key blackbox-mode-map "" (quote bb-up)) (define-key blackbox-mode-map "" (quote bb-down)) (define-key blackbox-mode-map "" (quote bb-eol)) (define-key blackbox-mode-map "" (quote bb-bol)) (define-key blackbox-mode-map " " (quote bb-romp)) (define-key blackbox-mode-map "" (quote bb-done)))

(put (quote blackbox-mode) (quote mode-class) (quote special))

(defun blackbox-mode nil "\
Major mode for playing blackbox.

SPC -- send in a ray from point, or toggle a ball
RET -- end game and get score

Precisely,\\{blackbox-mode-map}" (interactive) (byte-code "ÅˆÆ ˆÇ!ˆÂ‰ˆÈ‰ˆÉ‰‡" [blackbox-mode-map truncate-lines t major-mode mode-name nil kill-all-local-variables use-local-map blackbox-mode "Blackbox"] 4))

(defun blackbox (num) "\
Play blackbox.  Arg is number of balls." (interactive "P") (byte-code "ÅˆÊË!ˆÌ ˆÁ‰ˆÍp!ˆÎ† Ï!‰ˆÅ‰ˆÐ‰ˆÐ‰ˆÑ‰ˆÑ‰	ˆÒ ˆÓB!‡" [buffer-read-only t bb-board num bb-balls-placed nil bb-x bb-y bb-score bb-detour-count switch-to-buffer "*Blackbox*" blackbox-mode buffer-flush-undo bb-init-board 4 -1 0 bb-insert-board bb-goto] 8))

(defun bb-init-board (num-balls) (byte-code "ÄÀ!ˆÅÅS‰ÆY…5 ÇÄ È\"ÇÄ È\"B‰ˆÉ
	\"…+ Åˆ‚ ˆ
	B‰ˆ‚ ˆ	*‡" [t board pos num-balls random nil 0 logand 7 bb-member] 9))

(defun bb-insert-board nil (byte-code "ÂÂÃ ˆÄcˆÅ‰ˆS‰ÆY… Çcˆ‚ ˆÄc*‡" [i buffer-read-only nil erase-buffer "                     
" 8 0 "   - - - - - - - -   
"] 3))

(defun bb-right nil (interactive) (byte-code "ÁˆÂUƒ Á‚ ÃÄ!ˆT‰‡" [bb-x nil 8 forward-char 2] 3))

(defun bb-left nil (interactive) (byte-code "ÁˆÂUƒ Á‚ ÃÄ!ˆS‰‡" [bb-x nil -1 backward-char 2] 3))

(defun bb-up nil (interactive) (byte-code "ÁˆÂUƒ Á‚ ÃÄ!ˆS‰‡" [bb-y nil -1 previous-line 1] 3))

(defun bb-down nil (interactive) (byte-code "ÁˆÂUƒ Á‚ ÃÄ!ˆT‰‡" [bb-y nil 8 next-line 1] 3))

(defun bb-eol nil (interactive) (byte-code "ÂˆÃ‰ˆÄ	B!‡" [bb-x bb-y nil 8 bb-goto] 3))

(defun bb-bol nil (interactive) (byte-code "ÂˆÃ‰ˆÄ	B!‡" [bb-x bb-y nil -1 bb-goto] 3))

(defun bb-romp nil (interactive) (byte-code "ÃˆÄU† ÅU… 	ÄU† 	ÅU†, Æ	\"ƒ( Ç	\"‚, È	\"‡" [bb-x bb-y t nil -1 8 bb-outside-box bb-trace-ray bb-place-ball] 5))

(defun bb-place-ball (x y) (byte-code "	
BÅ\"ƒ Æ\"‰ˆÇÈ!‚! B‰ˆÇÉ!)‡" [coord x y bb-balls-placed t bb-member bb-delete bb-update-board "-" "O"] 5))

(defun bb-trace-ray (x y) (byte-code "ÆÁ

ÇUƒ È‚ 
ÉUƒ Ç‚ ÊÇUƒ# È‚. ÉUƒ- Ç‚. Ê%Ë=ƒA ÌÍ!ˆT‰‚s Î
B\"ƒU ÌÏ!ˆT‰‚s T‰ˆÌÐÑ\"!ˆŠÒ!ˆÌÐÑ\"!)ˆÓ\\‰)‡" [result t x y bb-score bb-detour-count bb-trace-ray-2 -1 1 8 0 hit bb-update-board "H" equal "R" format "%d" bb-goto 2] 11))

(defun bb-trace-ray-2 (first x dx y dy) (byte-code "?…	 È	
\"ƒ 	
B‚h É	\\
\\B\"ƒ# Ê‚h ÉË	#Ë
#B\"ƒ@ ÌÆ	[
[%‚h ÉË	[#Ë
[#B\"ƒ] ÌÆ	
%‚h ÌÆ	\\
\\%‡" [first x y dx dy bb-board nil t bb-outside-box bb-member hit + bb-trace-ray-2] 16))

(defun bb-done nil (interactive) (byte-code "ÄˆÄ	G
GU?ƒ ÅÆ	G\"‚; Ç	
\"‰ˆÈUƒ) ÅÉ\"‚7 ÊË\"\\‰ˆÅÌ#ˆÍÎ!)‡" [bogus-balls bb-balls-placed bb-board bb-score nil message "Spud!  You have only %d balls in the box." bb-show-bogus-balls 0 "Right!  Your score is %d." * 5 "Veg!  You missed %d balls.  Your score is %d." bb-goto (-1 . -1)] 8))

(defun bb-show-bogus-balls (balls-placed board) (byte-code "Â	Ã#ˆÂ	Ä#‡" [balls-placed board bb-show-bogus-balls-2 "x" "o"] 5))

(defun bb-show-bogus-balls-2 (list-1 list-2 c) (byte-code "?ƒ	 Ä‚* Å@	\"ƒ ÆA	
#‚* Ç@!ˆÈ
!ˆÆA	
#T‡" [list-1 list-2 c t 0 bb-member bb-show-bogus-balls-2 bb-goto bb-update-board] 8))

(defun bb-outside-box (x y) (byte-code "ÂU† ÃU† 	ÂU† 	ÃU‡" [x y -1 8] 2))

(defun bb-goto (pos) (byte-code "ÁÂ@Ã\"ÂAÄ\"Å#b‡" [pos + * 2 22 26] 6))

(defun bb-update-board (c) (byte-code "ÁÃ
GS!ˆÄ
G!ˆ
cˆÃÅ!)‡" [buffer-read-only nil c backward-char delete-char 1] 4))

(defun bb-member (elt list) "\
Returns non-nil if ELT is an element of LIST.  Comparison done with equal." (byte-code "ÁÂÃÄ\"B!‡" [list eval or mapcar (lambda (x) (byte-code "Â	\"‡" [x elt equal] 3))] 5))

(defun bb-delete (item list) "\
Deletes ITEM from LIST and returns a copy." (byte-code "Ã	@\"ƒ 	A‚ 	@Ä	A\"B‡" [item list t equal bb-delete] 5))
