From: blu@cellar.org (Dan Reed)
Newsgroups: alt.cad.autocad
Subject: Lisp Game : Cannon Blast!
Date: 22 Dec 92 13:59:04 GMT
Organization: The Cellar BBS and public access system

Ok, Ok, This is a goofy fun (well kinda) game, written in lisp.  Worked fine 
on 9,10,11, and 12.  Have fun you AutoGeeks, happy hoidays,,'

----Cut Me *Here!*----
(defun C:CANNON ()
  (SETVAR "CMDECHO" 0)
  (SETVAR "BLIPMODE" 0)
  (SETVAR "HIGHLIGHT" 0)
  (COMMAND "LIMITS" "-600,-300" "1800,1080")
  (COMMAND "GRID" "OFF")
  (COMMAND "ZOOM" "A")
  (PROGN     ;CREATE THE CANNON BLOCK
       (COMMAND "LINE" "-348,48" "-180,36" "-180,12" "-264.4975,5.9645" "")
       (COMMAND "ARC" "-348,48" "C" "-348,24" "-348,0")
       (COMMAND "LINE" "-348,0" "-335.9898,0.8579" "")
       (COMMAND "POINT" "-300,0")
       (COMMAND "BLOCK" "CANNON" "-300,0" "W" "-384,-48" "-168,60" "")
  )
  (PROGN     ;CREATE THE CANNONBALL BLOCK
       (COMMAND "CIRCLE" "0,0" "8,0")
       (COMMAND "BLOCK" "BALL" "0,0" "L" "")
  )
  (PROGN     ;CREATE THE AMMUNITION DUMP
       (COMMAND "LINE" "-12,0" "-12,-36" "-48,-36" "-48,0"
                      "48,0" "48,-36" "12,-36" "12,0" "")
       (COMMAND "LINE" "18,0" "18,36" "-18,36" "-18,0" "")
       (COMMAND "BLOCK" "AMO" "0,0" "W" "-60,-60" "60,60" "")
  )
  (PROGN     ;CREATE THE CANNON WHEEL BASE
       (COMMAND "CIRCLE" "-300,0" "-276,0")
       (COMMAND "CIRCLE" "-300,0" "-264,0")
  )
  (COMMAND "INSERT" "CANNON" "-300,0" 1 1 0)
  (setq SEED '(0.92412 0.75081 0.49014 0.09867 0.43629 0.06930 0.85240
               0.55830 0.31190 0.95364 0.50503 0.43701 0.24999 0.76237
               0.27236 0.20589 0.79133 0.50998 0.35895 0.13145 0.76697
               0.15255 0.36356 0.02105 0.01037 0.05387 0.35834 0.56651
               0.32854 0.77913 0.85262 0.49690 0.25513 0.17181 0.34821
               0.51985 0.55691 0.59619 0.40174 0.31858 0.63265 0.07755
               0.43698 0.47971 0.63173 0.63858 0.79850 0.95529 0.12762
               0.21966 0.50574 0.30996 0.30940 0.97785 0.65484 0.37272
               0.70261 0.28809 0.22328 0.80026 0.19859 0.21764 0.96066
               0.26729 0.45940 0.41294 0.89672 0.32688 0.37378 0.02626
               0.56586 0.23204 0.96704 0.31713 0.13530 0.97792 0.81630
               0.69192 0.03222 0.31153 0.39023 0.99266 0.19282 0.26443
               0.62042 0.61436 0.50483 0.69151 0.21966 0.31796 0.18239
               0.14698 0.59028 0.21429 0.50064 0.99692 0.41380 0.12192
               0.32520 0.75543))
  (setq OFFSETANGLE 0.197395)
  (setq OFFSETDIST 122.3765)
  (setvar "LIMCHECK" 0)
  (setq BASE (getreal "\nEnter a Number Between 1 and 10... "))
  (while BASE
    (setq POSITION 1)
    (while (<= POSITION 100)
      (setq RANDOM (* (nth POSITION SEED) BASE))
      (while (> RANDOM 1)
        (setq RANDOM (1- RANDOM))
      )
      (setq RANDOM (* RANDOM 1200))
      (setq AMODUMPXY (list RANDOM 0))
      (command "INSERT" "AMO" AMODUMPXY 1 1 0)
      (setq TRYS (getint "\nHow Many Trys Do You Want?  "))
      (while (> TRYS 0)
        (IF VELOCITYS (PROGN
             (SETQ PR (STRCAT "Enter Cannonball Velocity (ft/sec) <"
                               VELOCITYS ">...  "))
             (SETQ VELOCITYS (IF (= (SETQ TEST (GETSTRING PR)) "")
                               VELOCITYS TEST))     )
             (SETQ VELOCITYS (GETSTRING "\nEnter Cannonball Velocity 
(ft/sec)...  "))
        )
        (SETQ VELOCITY (ATOF VELOCITYS))
        (IF CANANGLES (PROGN
             (SETQ PR (STRCAT "Enter Cannon Angle <" CANANGLES ">...  "))
             (SETQ CANANGLES (IF (= (SETQ TEST (GETSTRING PR)) "")
                               CANANGLES TEST))     )
             (SETQ CANANGLES (GETSTRING "\nEnter Cannon Angle...  "))
        )
        (SETQ CANANGLE (ATOF CANANGLES))
        (setq CANRAD (/ (* PI CANANGLE) 180))
        (command "CHANGE" "-300,0" "" "" "" CANANGLE)
        (setq TIME 0 ENTITY 0)
        (setq INITIAL (polar (list -300 0) (+ OFFSETANGLE CANRAD) 
OFFSETDIST))
        (setq HIT "y")
        (while (= HIT "y")
          (setq BALLX (+ (car INITIAL) (* VELOCITY (cos CANRAD) TIME)))
          (setq BALLY (+ (cadr INITIAL) (- (* VELOCITY (sin CANRAD) TIME) (* 
2.735 TIME TIME))))
          (SETQ HIT (IF (> BALLX 1200) "N" (IF (< BALLY -72) "N" HIT)))
          (IF (>= BALLX (CAR (GETVAR "LIMMAX"))) T
               (IF (>= BALLY (CADR (GETVAR "LIMMAX"))) T
                    (PROGN (SETQ ENTITY (1+ ENTITY))
                           (COMMAND "INSERT" "BALL" (list BALLX BALLY) 1 1 0)
                    )
               )
          )
          (setq TIME (1+ TIME))
          (setq BALLDIST (distance (list BALLX BALLY) AMODUMPXY))
          (if (< BALLDIST 60) (setq HIT "n"))
        )
        (if (< BALLDIST 60) (progn
          (setq TRYS 0)
          (command "TEXT" "C" (getvar "VIEWCTR") "100" "0" "BOOM! YOU GOT 
IT!")
          (command "DELAY" "300")
          (setq ENTITY (1+ ENTITY))
                     )
          (setq TRYS (1- TRYS))
        )
        (setq A 1)
        (while (<= A ENTITY)
          (command "ERASE" "L" "")
          (setq A (1+ A))
        )
      )
      (setq POSITION (1+ POSITION))
      (command "ERASE" AMODUMPXY "")
      (IF (= (GETSTRING "Continue (RETURN another round or N to quit)...  ") 
"N")
             (PROGN
                (PRINT "Please QUIT this Drawing!")
                (SETQ POSITION 101)
                (SETQ BASE NIL)
             )
      )
    )
  )
)
----Cut me *here!*----

Some minor editing might be needed, only for line format..


     Dan Reed - blu@cellar.org - AutoCAD Geek -Industrial Music Lover
      68'Cougar, 89'VW Golf, 74'Honda Cb360, 89'Rollerblade Zetras'
  "Anyone can get a gun Otis. You can make a phone call and get a gun."
Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
Subject: (no subject given)