1 |
;;; blackbox.el --- blackbox game in Emacs Lisp |
;;; blackbox.el --- blackbox game in Emacs Lisp |
2 |
|
|
3 |
;; Copyright (C) 1985, 1986, 1987, 1992, 2001 Free Software Foundation, Inc. |
;; Copyright (C) 1985, 1986, 1987, 1992, 2001, 2002 Free Software Foundation, Inc. |
4 |
|
|
5 |
;; Author: F. Thomas May <uw-nsr!uw-warp!tom@beaver.cs.washington.edu> |
;; Author: F. Thomas May <uw-nsr!uw-warp!tom@beaver.cs.washington.edu> |
6 |
;; Adapted-By: ESR |
;; Adapted-By: ESR |
275 |
(insert (format "\nThere are %d balls in the box" (length bb-board))) |
(insert (format "\nThere are %d balls in the box" (length bb-board))) |
276 |
)) |
)) |
277 |
|
|
278 |
(defun bb-right () |
(defun bb-right (count) |
279 |
(interactive) |
(interactive "p") |
280 |
(if (= bb-x 8) |
(while (and (> count 0) (< bb-x 8)) |
|
() |
|
281 |
(forward-char 2) |
(forward-char 2) |
282 |
(setq bb-x (1+ bb-x)))) |
(setq bb-x (1+ bb-x)) |
283 |
|
(setq count (1- count)))) |
284 |
|
|
285 |
(defun bb-left () |
(defun bb-left (count) |
286 |
(interactive) |
(interactive "p") |
287 |
(if (= bb-x -1) |
(while (and (> count 0) (> bb-x -1)) |
|
() |
|
288 |
(backward-char 2) |
(backward-char 2) |
289 |
(setq bb-x (1- bb-x)))) |
(setq bb-x (1- bb-x)) |
290 |
|
(setq count (1- count)))) |
291 |
|
|
292 |
(defun bb-up () |
(defun bb-up (count) |
293 |
(interactive) |
(interactive "p") |
294 |
(if (= bb-y -1) |
(while (and (> count 0) (> bb-y -1)) |
|
() |
|
295 |
(previous-line 1) |
(previous-line 1) |
296 |
(setq bb-y (1- bb-y)))) |
(setq bb-y (1- bb-y)) |
297 |
|
(setq count (1- count)))) |
298 |
|
|
299 |
(defun bb-down () |
(defun bb-down (count) |
300 |
(interactive) |
(interactive "p") |
301 |
(if (= bb-y 8) |
(while (and (> count 0) (< bb-y 8)) |
|
() |
|
302 |
(next-line 1) |
(next-line 1) |
303 |
(setq bb-y (1+ bb-y)))) |
(setq bb-y (1+ bb-y)) |
304 |
|
(setq count (1- count)))) |
305 |
|
|
306 |
(defun bb-eol () |
(defun bb-eol () |
307 |
(interactive) |
(interactive) |