;;; These are the constants for the species diversity model

;------------------Constants---------------------------------

(defconstant XDIM 8) ; X dimension of the environment.
(defconstant XBORDER (1- XDIM))
(defconstant YDIM 8) ; Y dimension of the environment.
(defconstant YBORDER (1- YDIM))
(defconstant GENESIZE (logcount most-positive-fixnum)) ; Number of
						       ; bits in a
						       ; gene. 
(defconstant ADAPTZONE (round (/ (* 2 GENESIZE) 3)))
(defconstant NICHEZONE (round (/ GENESIZE 3)))
(defconstant SUBDIVOFFSET (- ADAPTZONE NICHEZONE))

(defconstant GENEMASK most-positive-fixnum) ; A string of 29 1's.
(defconstant NUMGENES 3) ; Number of bitpattern genes in an organism
			 ; structure. 

(defconstant ENERGY-CONVERSION 10) ; The number of meals required
				   ; before a predator can reproduce.
				   ; That is, the conversion rate of
				   ; prey into predators.

(defconstant REPRO-THRESHOLD (1- ENERGY-CONVERSION))

(defconstant MAX-FAST 3) ; The maximum number of time steps an
			 ; organism can survive without eating.

(defconstant MAX-FOOD-CAPACITY 100); max number of plants in a location.
(defconstant MAX-ORG-CAPACITY  (* 2 GENESIZE)) ; max number of animals in a
				   ; location.  Must be >= GENESIZE.

;;; This might have to change later.
(defconstant CAPACITY (+ MAX-FOOD-CAPACITY ; Maximum number of
			 MAX-ORG-CAPACITY))  ; organisms in one
					; environment location.
(defconstant RANK-CAPACITY (floor  MAX-ORG-CAPACITY
				      GENESIZE))
(defconstant PLANT-RANK-CAPACITY (floor  MAX-FOOD-CAPACITY
				      GENESIZE))

(defconstant BASE-TERRAIN 0) ; Default chance of failing to enter
			       ; an environment location.

(defconstant MAX-TERRAIN 1000) ; Range of barrier variables.
(defconstant MAX-CLIMATE-DIFF 4) ; 0 to n-1 bits are flipped to
				 ; differ the climate from the barrier
				 ; in a location.

(defconstant NOAH-FACTOR 3) ; Three of each type of organism is placed
			    ; in the environment at the start so that
			    ; they will have mates.