home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / CTECHAPP.ZIP / SIMULATN.ZIP / GRAZER.HPP < prev   
C/C++ Source or Header  |  1990-02-15  |  2KB  |  75 lines

  1. //  Header:     Grazer
  2. //  Version:    2.00
  3. //
  4. //  Language:   C++ 2.0
  5. //  Environ:    MS-DOS, Zortech C++ v2.0x
  6. //
  7. //  Purpose:    SIMECO Grazer class definition
  8. //
  9. //  Written by: Scott Robert Ladd
  10.  
  11. #if !defined(__GRAZER_HPP)
  12. #define __GRAZER_HPP 1
  13.  
  14. #include "Creature.hpp"
  15. #include "BitGrid.hpp"
  16.  
  17. class Grazer : public Creature
  18.     {
  19.     protected:
  20.         unsigned char Movement[8];  // chance of movement in a given direction
  21.         unsigned char MoveCount;    // sum of values in Movement[]
  22.  
  23.         unsigned char Sense;        // distance at which food is sensed
  24.  
  25.         static int Count;           // number of living grazers
  26.  
  27.         static int MaxEnergy;       // maximum energy
  28.         static int MaxAge;          // maximum age
  29.         static int MaxSense;        // maximum sense value
  30.         static int ReproAge;        // age at which a Grazer can reproduce
  31.         static int RepEnergy;       // energy required for reproduction
  32.         static int FoodValue;       // energy obtained from eating food
  33.  
  34.         static int NoMoveGenes;     // number of movement genes
  35.  
  36.         static int MoveTable[8][2]; // class-global table of movements
  37.  
  38.         static BitGrid *FoodSupply; // pointer to supply of food for grazers
  39.  
  40.         static int MaxX;            // maximum X dimension for Grazer
  41.         static int MaxY;            // maximum Y dimension for Grazer
  42.  
  43.     public:
  44.         // basic constructor
  45.         Grazer(int x, int y);
  46.  
  47.         // copy constructor (used in birth of a new Grazer)
  48.         Grazer(const Grazer & G);
  49.  
  50.         // destructor
  51.         ~Grazer();
  52.  
  53.         // retrieve number of living grazers
  54.         static int Population()
  55.             {
  56.             return Count;
  57.             }
  58.  
  59.         // set food supply and area dimensions
  60.         static void SetRegion(BitGrid * food, int xmax, int ymax);
  61.  
  62.         // ask grazer to do something
  63.         virtual int Move();
  64.  
  65.         // tell grazer to draw itself
  66.         virtual void Draw();
  67.  
  68.         // tell grazer to erase itself
  69.         virtual void Erase();
  70.     };
  71.  
  72.  
  73.  
  74. #endif
  75.