/[the-feebs-war]/main.lisp
ViewVC logotype

Diff of /main.lisp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 11 by gmilare, Mon Dec 31 21:35:35 2007 UTC revision 12 by gmilare, Wed Jan 2 15:40:42 2008 UTC
# Line 27  Line 27 
27  (defun rot-carcass-p (time)  (defun rot-carcass-p (time)
28    t)    t)
29    
 (defun reincarnate-feeb-p (feeb)  
   t)  
   
30  (defun finish-game-p ()  (defun finish-game-p ()
   ;; This is a little dangerous...  
31    nil)    nil)
32    
33    
# Line 53  parameter already existed with value ~a. Line 49  parameter already existed with value ~a.
49      (gethash name parameters))      (gethash name parameters))
50    
51    (defun change-parameter (name value)    (defun change-parameter (name value)
52      (setf (car (gethash name parameters)) value))      (unless *playing-feeb*
53          (setf (car (gethash name parameters)) value)))
54    
55    (defmethod documentation (name (type (eql 'feeb-parameter)))    (defmethod documentation (name (type (eql 'feeb-parameter)))
56      (cdr (gethash name parameters)))      (cdr (gethash name parameters)))
# Line 244  when the game begins." Line 241  when the game begins."
241        (dotimes (i mushrooms)        (dotimes (i mushrooms)
242          (let ((site (pop m-sites)))          (let ((site (pop m-sites)))
243            (unless (member #'fireball-p)            (unless (member #'fireball-p)
244                (create-mushroom (car site) (cdr site)))))                (create-mushroom (car site) (cdr site))))))
245      ;; Maybe rot some carcasses      ;; Maybe rot some carcasses
246      (dolist (carc (prog1 *carcasses*      (dolist (carc (prog1 *carcasses*
247                      (setf *carcasses* nil)))                      (setf *carcasses* nil)))
248        (unless (rot-carcass (first carc) (second carc) (third carc))        (if (rot-carcass-p (first carc))
249              (progn
250                (delete-object :carcass (second carc) (third carc))
251                (reincarnate-feeb (pop *dead-feebs*)))
252          (progn          (progn
253            (incf (first carc))            (incf (first carc))
254            (push carc *carcasses*))))            (push carc *carcasses*))))
# Line 256  when the game begins." Line 256  when the game begins."
256      (dolist (fireball *fireballs-flying*)      (dolist (fireball *fireballs-flying*)
257        (move-object fireball (make-move-choice fireball)))        (move-object fireball (make-move-choice fireball)))
258      (dolist (feeb *feebs*)      (dolist (feeb *feebs*)
259        (if (feeb-dead-p feeb)        ;; Starve the feeb:
260            ;; Reincarnate some feebs (if the rules allow it)        (when (<= (decf (feeb-energy-reserve feeb)) 0)
261            (reincarnate-feeb feeb)          (destroy-object feeb :starve)))
         (progn  
           ;; Starve the feeb:  
           (when (<= (decf (feeb-energy-reserve feeb)) 0)  
             (destroy-object feeb :starve))  
           ;; Compute vision for the feeb:  
           (compute-vision feeb))))  
262      (dolist (*playing-feeb* *feebs*)      (dolist (*playing-feeb* *feebs*)
263        (unless (feeb-dead-p *playing-feeb*)        ;; Compute vision for the feeb:
264          ;; Collect the feeb's move        (compute-vision feeb)
265          (move-object *playing-feeb*        ;; Lets the feeb make a choice
266                       (prog1        (setf (feeb-last-move *playing-feeb*)
267                           (setf (feeb-last-move *playing-feeb*)               (make-move-choice *playing-feeb*)
268                                 (make-move-choice *playing-feeb*))              (feeb-peeking *playing-feeb*) nil))
269                         (setf (feeb-peeking *playing-feeb*) nil))))))))      ;; binds the variable to the current playing feeb
270        (dolist (feeb *feebs*)
271  ) ; end of let ((mushrooms 1))        ;; Collect the feeb's move
272          (move-object feeb (feeb-last-move feeb))))
273    
274      ) ; end of let ((mushrooms 1))

Legend:
Removed from v.11  
changed lines
  Added in v.12

  ViewVC Help
Powered by ViewVC 1.1.5