Author: gmilare Date: Sat Aug 7 09:40:44 2010 New Revision: 21
Log: Corrected mistakes in feebs.tex and enhanced printing of game (thanks to XIE Wensheng)
Modified: documentation/feebs.tex graphics/graphics.lisp
Modified: documentation/feebs.tex ============================================================================== --- documentation/feebs.tex (original) +++ documentation/feebs.tex Sat Aug 7 09:40:44 2010 @@ -18,7 +18,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
-% Copyright (c) 2007,2008 Gustavo Henrique Milar� +% Copyright (c) 2007,2008 Gustavo Henrique Milar� % % This file is part of The Feebs War. % @@ -76,9 +76,9 @@ \begin{abstract} \textit{The Feebs War} is a modified version of Planet of The Feebs \url{http://www.cliki.net/Planet%5C%20of%5C%20the%5C%20Feebs%7D, a game made for people learn and improve their lisp and code manipulation -tecniques. The graphics are now displayed using Lispbuilder \url{http://lispbuilder.sourceforge.net%7D%27s +techniques. The graphics are now displayed using Lispbuilder \url{http://lispbuilder.sourceforge.net%7D%27s libraries, so the problems with portability from CMUCL and X Window -Sistem do not exist anymore. Also the code is cleaner and more extensible. +System do not exist anymore. Also the code is cleaner and more extensible. \end{abstract} \tableofcontents{}
@@ -87,8 +87,8 @@
The Feebs are intelligent and hostile creatures that live inside maze tunnels. They also have no mercy with each other, so they frequently -throw a letal flame from through their mouth, getting rid of their -opponent and eatting the carcass left. But throwing flames have an +throw a lethal flame from through their mouth, getting rid of their +opponent and eating the carcass left. But throwing flames have an energy cost, so they must keep tracking for food.
This game is intended to help lisp newbies (or maybe a little more @@ -108,7 +108,7 @@
The main reason of this project is that \textit{Planet of the Feebs} is really interesting for (not just) newbies to learn lisp, but the -difficulties to install, unportability and the ausence of competitors +difficulties to install, unportability and the absence of competitors make it difficult to someone to be interested in making a feeb. So, I hope that making these adjustments and maybe creating some contests over the web make people be more interested in learning lisp. @@ -116,13 +116,13 @@ So, these are (some of) the changes:
\begin{itemize} -\item The graphics are not based on X Window Sistem anymore, but on \textit{Lispbuilder}, +\item The graphics are not based on X Window System anymore, but on \textit{Lispbuilder}, and there are no CMUCL's event handler. This way, the code is more portable and graphics can be improved. Just creating some image files of a feeb and your feeb is much more personalized! \item Every element of the map (including walls) is a list, so the brain of a feeb doesn't need to test all the time if the element is an atom -or a list (wich, in my opinion, is really boring, unlispy and unnecessary +or a list (which, in my opinion, is really boring, unlispy and unnecessary in this case). That was only a reason to duplicate code and work, adding no results at all... \item Many functions and variables are changed and others were added @@ -160,7 +160,7 @@ be a rational number (like 1/2).
But don't panic! These parameters are just for one to know how the -game is going to be, but in the begining there is no need to explicitly +game is going to be, but in the beginning there is no need to explicitly use them when creating the brain of a feeb. The best way to create a feeb is watching a game (among system feebs), improving it (it is defined in file brains.lisp) a little more, testing the changes... @@ -202,13 +202,13 @@ turns that a fireball is guaranteed not to dissipate, unless it encounters a wall. \item [{{\textsf{\textbf{'fireball-dissipation-probability}}}}] Probability -of the flame to dissipate each turn after the apropriate time. +of the flame to dissipate each turn after the appropriate time. \item [{{\textsf{\textbf{'fireball-reflection-probability}}}}] Probability of the flame to reflect when encountering a wall. \item [{{\textsf{\textbf{'flame-no-recovery-time}}}}] Number of turns that a feeb cannot fire. \item [{{\textsf{\textbf{'flame-recovery-probability}}}}] Probability -of the feeb to recover the hability to throw a flame, after the apropriate +of the feeb to recover the ability to throw a flame, after the appropriate time. \end{lyxlist}
@@ -216,9 +216,9 @@
There are two kinds of food, carcasses and mushrooms. Carcasses usually give less energy than mushrooms, and may rot, but, while it does not -rot, a feeb can feed as long as it wishes. Mushrooms disapear after +rot, a feeb can feed as long as it wishes. Mushrooms disappear after being eaten. By eating food, the feeb will be able to recover energy, -wich is important because, if a feeb stays with 0 or less units of +which is important because, if a feeb stays with 0 or less units of energy, it starves.
These are the quantities: @@ -232,7 +232,7 @@ turns that a carcass will surely not rot. After these turns, it can rot, depending on probabilities. \item [{{\textsf{\textbf{'carcass-rot-probability}}}}] Probability of -the carcass to rot, after the apropriate time. +the carcass to rot, after the appropriate time. \item [{{\textsf{\textbf{'maximum-energy}}}}] Maximum amount of energy that a feeb can have eating. \item [{{\textsf{\textbf{'starting-energy}}}}] Amount of energy a feeb @@ -266,7 +266,7 @@ After processing the information available, the brain will take a decision. If this decision is not one of the decisions listed down, a warning will be signaled, and the result will be like \textsf{\textbf{:wait}}. -Then, if someone are testing a brain function, he or she will be able +Then, if someone is testing a brain function, he or she will be able to know if something goes wrong.
The possible values that the brain function can return are these: @@ -283,8 +283,8 @@ \item [{{\textsf{\textbf{:peek-left}}}}] Peek to the left around a corner. The creature does note actually move, but, in the next turn, the creature will have the same vision that it would have if he had moved one step -foward and turned left (and one step back because the feeb needs to -see what is actually in front of it). Peeking used so a feeb can analize +forward and turned left (and one step back because the feeb needs to +see what is actually in front of it). Peeking used so a feeb can analyze a corridor before trespassing it. \item [{{\textsf{\textbf{:peek-right}}}}] Peek to the right around a corner, analogous to \textsf{\textbf{:peek-left}}. @@ -326,7 +326,7 @@ \begin{flushleft} Where the feeb is facing to, one of the constants provided: \textsf{\textbf{north}}, \textsf{\textbf{east}}, \textsf{\textbf{south}} or \textsf{\textbf{west}}, -wich are 0, 1, 2 and 3 respectivelly. +which are 0, 1, 2 and 3 respectively. \par\end{flushleft}
\item [{{\textsf{\textbf{(x-position}}\textsf{\emph{~status}}\textsf{\textbf{)}}}}]~ @@ -379,7 +379,7 @@
\begin{flushleft} -Related with timing. Returns \textsf{\textbf{T}} if the last move +Related to timing. Returns \textsf{\textbf{T}} if the last move of feeb was aborted because of timing issues. \par\end{flushleft}
@@ -398,7 +398,7 @@ The brain receives also information about what is near the feeb and what the feeb sees. We note that, contrary to \emph{Planet of the Feebs}, it is safe to change anything inside these structures, so -you are alowed to keep them stored and to modify them as you wish. +you are allowed to keep them stored and to modify them as you wish.
The structure \textsf{\emph{proximity}} has the contents of the squares near the feeb (not affected by peeking) with these fields: @@ -432,7 +432,7 @@ Contents of the square behind the feeb. \par\end{flushleft}
-\item [{{The}}] vector \textsf{\emph{vision}} has the contents of the +The vector \textsf{\emph{vision}} has the contents of the squares that are in front of the feeb. For example, \textsf{\textbf{(aref}}\textsf{\emph{~vision~}}\textsf{0}\textsf{\textbf{)}} will return the contents of the square in front of the feeb, \textsf{\textbf{(aref}}\textsf{\emph{~vision~}}\textsf{1}\textsf{\textbf{)}} will return the contents of the next square, and so on. As said before, @@ -465,14 +465,14 @@ can access. It is allowed to keep and change its contents because they won't be used internally.
-These are the accessors available (they read and change the fiels): +These are the accessors available (they read and change the flies):
\begin{lyxlist}{00.00.0000} \item [{{\textsf{\textbf{(feeb-image-name}}\textsf{~feeb-image}\textsf{\textbf{)}}}}]~
\begin{flushleft} -The name of the feeb. (Maybe you know it's weakpoints?) +The name of the feeb. (Maybe you know it's weak points?) \par\end{flushleft}
\item [{{\textsf{\textbf{(feeb-image-facing}}\textsf{~feeb-image}\textsf{\textbf{)}}}}]~ @@ -543,8 +543,8 @@
If you want to create a new map, you can start by an empty template of any size that is provided by \textsf{\textbf{(make-template}}\textsf{~x-size~y-size}\textsf{\textbf{)}}, -or you can get a reandom map calling \textsf{\textbf{(generate-maze}}\textsf{~x-size~y-size~}\textsf{\textbf{:density}}\textsf{~density}\textsf{\textbf{)}} -The density is a number, recomended to be between 0.25 and 0.45, which +or you can get a random map calling \textsf{\textbf{(generate-maze}}\textsf{~x-size~y-size~}\textsf{\textbf{:density}}\textsf{~density}\textsf{\textbf{)}} +The density is a number, recommended to be between 0.25 and 0.45, which tells the portion of the maze should be blank spaces. The function quits after a while if it doesn't meet this portion. See its documentation for more details and options. @@ -556,7 +556,7 @@ of a feeb when creating it, so your feeb will be more personalized.
The graphic of a feeb is defined by an image file, which should have -three colunms by eight lines of pictures of the same size. The four +three columns by eight lines of pictures of the same size. The four first lines must be the animations of the feeb walking up, left, down and right, respectively. The next four lines must be the pictures of the feeb flaming up, left, down and right, respectively. To see @@ -577,7 +577,7 @@
\section{Contests}
-I sugest that you see this chapter only after you have created at +I suggest that you read this chapter only after you have created at least a basic brain feeb, which is better than the (simple) provided brain, or if you want to participate of a contest or a game with your friends. @@ -588,7 +588,7 @@ It is possible to get the maze map during the game, but with only the corridors. Note that the function that gets the map is purposely a little slow, so, invoking it too many times in a contest that uses -timing atributes is not a good idea; anyway, it is possible to invoke +timing attributes is not a good idea; anyway, it is possible to invoke this function before defining the feeb, and store its value somewhere. Also note that the map returned does not have any information about what is really in the maze, but only the possible ways. @@ -610,13 +610,13 @@ \item [{{\textsf{\textbf{nil}}}}] An {}``empty'' place, i.e. neither of the previous. \end{lyxlist} -This map can safelly be used since \textsf{\textbf{(get-maze-map)}} +This map can safely be used since \textsf{\textbf{(get-maze-map)}} makes a new copy every time it is called.
\subsection{Timing}
-There are also some timing atributes that can be given to the game. +There are also some timing attributes that can be given to the game. The more time the feeb takes make a decision, greater is the probability of its command to be aborted.
Modified: graphics/graphics.lisp ============================================================================== --- graphics/graphics.lisp (original) +++ graphics/graphics.lisp Sat Aug 7 09:40:44 2010 @@ -1,6 +1,6 @@ ;;; -*- Common Lisp -*-
-#| Copyright (c) 2007,2008 Gustavo Henrique Milar� +#| Copyright (c) 2007,2008 Gustavo Henrique Milaré
This file is part of The Feebs War.
@@ -31,40 +31,50 @@ (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 "~%"))) - + (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 do - (play-one-turn) - (print-map) - (sleep 0.7) - (format t "~%~%") - (if (finish-game-p) (return))) + (loop until (finish-game-p) + do + (play-one-turn) + (print-map) + (sleep 0.7)) (format t "Game Over!!~%~%Scores:~%~%") - (dolist (feeb *feebs*) - (format t "~a: ~d~%" (feeb-name feeb) (feeb-score feeb)))) + (let ((scores nil)) + (dolist (feeb *feebs*) + (push (list (feeb-name feeb) (feeb-score feeb)) + scores)) ;collect living feebs' sores + (dolist (feeb *dead-feebs*) + (push (list (feeb-name feeb) (feeb-score feeb)) + scores)) ;collect dead feebs' scoes + (sort scores #'> :key #'second) ;sort the scores in dcreasing order + (dolist (score scores) + (format t "~30@<~a:~> ~@d~%" + (first score) (second score))))) ;print out scores
#|