;;;
;;; -*- Mode: Lisp -*-
;;;
;;; $Header: /home/gene/library/website/docsrc/nff11/RCS/aaa.lisp,v 395.1 2008/04/20 17:25:50 gene Exp $
;;;
;;; Copyright (c) 2005 Gene Michael Stover.  All rights reserved.
;;;
;;; This program is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as
;;; published by the Free Software Foundation; either version 2.1 of the
;;; License, or (at your option) any later version.
;;; 
;;; This program is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;; General Public License for more details.
;;; 
;;; You should have received a copy of the GNU Lesser General Public
;;; License along with this program; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
;;; USA
;;;

(defstruct beastie
  xp                                    ; XP earned by KOing this monster
  battle                                ; time to battle, seconds
  pull)                                 ; time to pull, seconds

(defun make-rates-table ()
  (let ((xp '(20 25 36 50 100 200))
	(battle 60))
    (with-output-to-string (strm)
      (format strm "~&\\begin{table}")
      (format strm "~&\\begin{tabular}{r")
      (dotimes (i (length xp)) (format strm "|r"))
      (format strm "} \\\\")
      (format strm "~&{\\bf pull time}")
      (dolist (i xp) (format strm " & {\\bf ~A}" i))
      (format strm " \\\\ \\hline")
      (dolist (pull '(0 15 30 60 120 300))
	(format strm "~&~A" pull)
	(dolist (i xp)
	  (format strm " & ~,2F" (/ i (+ battle pull))))
      (format strm " \\\\ \\hline"))
      (format strm "~&\\end{tabular}")
      (format strm "~&\\caption{Rates, in $XP/second$, of earning XP")
      (format strm "~&for various beastie")
      (format strm "~&difficulties, assuming battle time is always")
      (format strm "~&~A seconds}" battle)
      (format strm "~&\\label{tab-rates}")
      (format strm "~&\\end{table}"))))

(defun make-rates-table2 ()
  "Like MAKE-RATES-TABLE except that it uses longer battle
times for tougher foes."
  (let ((mobs (list
	     (make-beastie :xp  20 :battle  20)
	     (make-beastie :xp  25 :battle  25)
	     (make-beastie :xp  36 :battle  30)
	     (make-beastie :xp  50 :battle  45)
	     (make-beastie :xp 100 :battle  60)
	     (make-beastie :xp 200 :battle 120))))
    (with-output-to-string (strm)
      (format strm "~&\\begin{table}")
      (format strm "~&\\begin{tabular}{r")
      (dotimes (i (length mobs)) (format strm "|r"))
      (format strm "} \\\\")
      (format strm "~&{\\bf pull time}")
      (dolist (i mobs)
	(format strm " & {\\bf ~A (~A)}" (beastie-xp i) (beastie-battle i)))
      (format strm " \\\\ \\hline")
      (dolist (pull '(0 15 30 60 120 300))
	(format strm "~&~A" pull)
	(dolist (i mobs)
	  (format strm " & ~,2F"
		  (/ (beastie-xp i) (+ (beastie-battle i) pull))))
      (format strm " \\\\ \\hline"))
      (format strm "~&\\end{tabular}")
      (format strm "~&\\caption{Rates, in $XP/second$, of earning XP")
      (format strm "~&for various beastie difficulties, using different")
      (format strm "~&battle times for each beastie difficulty}")
      (format strm "~&\\label{tab-rates}")
      (format strm "~&\\end{table}"))))

;;; --- end of file ---
