[the-feebs-war-devel] document reviewed

Xie, WenSheng WenSheng.Xie at harman.com
Wed Aug 4 07:48:56 UTC 2010


Hi, Gustavo:

Great to hear that you are thinking of working on this project later on.

It's fun to practice my lisp with this project.

What's your plan to make it a network/web-based multi-user game?

Further, I modify the graphics/graphics.lisp slightly to make clearer display: (in red below)

(in-package :the-feebs-war)

 (defun print-direction (dir)
  (case dir
    (0 #\N)
    (1 #\E)
    (2 #\S)
    (3 #\W)))

(defun print-map ()
  (format t "~%")  ;add this line
  (dotimes (y *maze-y-size*)
    (dotimes (x *maze-x-size*)
      (let ((elt (aref *maze* x y)))
        (apply 'format t
               (cond
                 ((wallp elt)
                  (list " XX"))
                 ((feeb-p (car elt))
                  (list " F~a"
                        (print-direction (feeb-facing (car elt)))))
                 ((fireball-p (car elt))
                  (list " *~a" (print-direction (fireball-direction (car elt)))))
                 ((eq (car elt) :mushroom)
                  (list " mm"))
                 ((eq (car elt) :carcass)
                  (list " cc"))
                 (t (list "   "))))))
    (format t "~%"))
  (format t "~%")) ;add this line

(defun simple-play (&optional layout)
  (if layout
      (change-layout layout))
  (make-auto-feebs (- 10 (length *feebs-to-be*)))
  (initialize-feebs)
  (start-round)
  (loop until (finish-game-p)
     do
       (play-one-turn)
       (print-map)
       (sleep 0.7))
  (format t "Game Over!!~%~%Scores:~%~%")
  (let ((scores nil))
    (dolist (feeb *feebs*)
      (push (list (feeb-name feeb) (feeb-score feeb)) scores)) ;collect living feebs' scores
    (dolist (feeb *dead-feebs*)
      (push (list (feeb-name feeb) (feeb-score feeb)) scores)) ;collect dead feebs' scores
    (sort scores #'> :key #'second)                               ;sort the scores in decreasing order
    (dolist (score scores)
      (format t "~30@<~a:~> ~@d~%" (first score) (second score)))))  ;print out scores

Please check if there are helpful when you have time.

Best regards,
XIE Wensheng

________________________________
From: Gustavo [mailto:gugamilare at gmail.com]
Sent: Wednesday, August 04, 2010 8:55 AM
To: the-feebs-war-devel at common-lisp.net
Subject: Re: [the-feebs-war-devel] document reviewed

Hello, XIE Wensheng,

I'm sorry for not approving your post, but it's been so much time that I've lost the admin password.

As you can see, the project is a little dead :S

I might work on it again at the end of this year or beginning of the next one, but no promises.

The document file has been reviewed and some spelling errors are corrected.

Thank you for reviewing the .tex file, I'll take a look at it and commit later, and sorry for the spell mistakes.

One question:

Why the parameter 'fireball-guaranteed-lifetime is not used in the program?
How to use it?

It's a bug, I missed it, thanks for reporting. Now it is (hopefully) fixed and committed (fortunately I remember the svn password :)

In case you wonder, these are the changes: in systems.lisp, create a slot named lifetime:

(defclass object ()
  ((direction  :accessor object-direction  :initarg :direction)
   (x-position :accessor object-x-position :initarg :x-position)
   (y-position :accessor object-y-position :initarg :y-position)
   (lifetime   :accessor object-lifetime   :initarg :lifetime :initform 0)))


add a method for make-move:

(defmethod make-move :after (object move)
  (incf (object-lifetime object)))


and, in definitions/rules.lisp, make these changes:

(def-feeb-parm 'fireball-guaranteed-lifetime 3
  "Number of turns that a fireball is guaranteed not to dissipate,
unless it encounters a wall.")

(defmethod make-move-choice ((fireball fireball))
  (cond
   ((wallp (get-forward-pos fireball))
    (if (chance (get-feeb-parm 'fireball-reflection-probability))
        :turn-around
        :dissipate))
   ((and (>= (object-lifetime fireball)
             (get-feeb-parm 'fireball-guaranteed-lifetime))
         (chance (get-feeb-parm 'fireball-dissipation-probability)))
    :dissipate)
   (t :move-forward)))


Regards,
Gustavo.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/the-feebs-war-devel/attachments/20100804/6bd0c3d0/attachment.html>


More information about the the-feebs-war-devel mailing list