blob: 757bb959d26651673cae02ed8876835799d67e52 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
;;;; MathSlap program written by Larry Heyl - Game developed by Carl Heyl
;;;; To win make an equation with the supplied numbers, in order, adding any symbols you want but one and only one equal sign.
;;;; concise instructions
(print "MathSlap")
(print "Hit Enter for another number. q and Enter to quit.")
(defparameter *line* "")
(defparameter *out* "MathSlap ")
(defparameter *random-state* 0)
(setq *random-state* (make-random-state t))
;;;; append string parameter with a random number 1 through 10 and a space
(defun concat (o)
(concatenate 'string o (write-to-string (+ (random 10) 1)) " ")
)
;;;; append out with a random number 1 through 10 and a space
(setq *out* (concat *out*))
;;;; comment next line to start with 2 numbers - leave uncommented to start with 3 numbers
(setq *out* (concat *out*))
;;;; loop until user types q and Enter
(loop
while (= 1 1)
do
(setq *out* (concat *out*))
(print *out*)
(finish-output)
;;;; wait for input
(setq *line* (read-line *standard-input*))
(when (string= *line* "q")(quit))
)
|