aboutsummaryrefslogtreecommitdiff
path: root/mathslap.clisp
diff options
context:
space:
mode:
authorLarry Heyl <hairylarry@gmail.com>2026-07-15 02:06:15 +0000
committerLarry Heyl <hairylarry@gmail.com>2026-07-15 02:06:15 +0000
commit01a450503aadd41f92bb429c7a2ed4312f6d000b (patch)
treec49c420130cf0be3d89d2190a06a46de5ce2d085 /mathslap.clisp
parent8d0e2443eb5c9f626f7d7f5472c8229d2fc31d2e (diff)
Edit mathslap.clisp after code review by Gene Pasquet
Diffstat (limited to 'mathslap.clisp')
-rw-r--r--mathslap.clisp37
1 files changed, 22 insertions, 15 deletions
diff --git a/mathslap.clisp b/mathslap.clisp
index 29c7241..757bb95 100644
--- a/mathslap.clisp
+++ b/mathslap.clisp
@@ -1,26 +1,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 "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 "")
+
+(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
-(set 'out (concatenate 'string "MathSlap " (write-to-string (+ (random 10) 1)) " "))
+(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
-(setf index 1)
(loop
- while (< index 10)
+ while (= 1 1)
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)
+ (setq *out* (concat *out*))
+ (print *out*)
(finish-output)
;;;; wait for input
- (setq line (read-line *standard-input*))
- (when (string= line "q")(quit))
+ (setq *line* (read-line *standard-input*))
+ (when (string= *line* "q")(quit))
)
-