blob: 29c72415bb4a3c63db1e113c06c71f2f30b9df3d (
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
|
;;;; 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.")
(setf *random-state* (make-random-state t))
(defparameter index 0)
(defparameter line "")
(defparameter out "")
;;;; append out with a random number 1 through 10 and a space
(set 'out (concatenate 'string "MathSlap " (write-to-string (+ (random 10) 1)) " "))
;;;; loop until user types q and Enter
(setf index 1)
(loop
while (< index 10)
do
(+ index 1)
;;;; append out with a random number 1 through 10 and a space
(set 'out (concatenate 'string out (write-to-string (+ (random 10) 1)) " "))
(print out)
(finish-output)
;;;; wait for input
(setq line (read-line *standard-input*))
(when (string= line "q")(quit))
)
|