;; Programarea Web... altfel ;; de Alexandru Deva ;; www.pwa.ro (defun throw-die () (+ 1 (random 6))) (defun throw-dice () (list (throw-die) (throw-die))) (defun snake-eyes-p (throw) (equal 1 (* (first throw) (second throw))) ) (defun boxcars-p (throw) (and (equal (first throw) 6) (equal (second throw) (first throw)))) (defun instant-win (throw) (or (equal 7 (+ (first throw) (second throw))) (equal 11 (+ (first throw) (second throw))))) (defun instant-loss-p (throw) ( setf suma (+ (first throw) (second throw)) ) (cond ( (or (equal suma 2) (equal suma 3) (equal suma 12)) 't) (nil)) ) (defun say-throw (throw) (let* ((suma (+ (first throw) (second throw)))) (cond ((snake-eyes-p throw) 'SNAKE-EYES) ((boxcars-p throw) 'BOXCARS) (suma)) ) ) (defun craps () (let* ( (my-throw (throw-dice) ) ) (list 'throw (first my-throw) 'and (second my-throw) '-- (say-throw my-throw) '-- ) ) ) (craps)