/************************************************************ * * wator.h * AUTHOR: Sue Evans * DATE: 3/19/2005 * * This is a *partial* header file for wator that includes Wa-Tor's * ocean. It includes constants and structures that you must use in * order to work with creation.o, the package that initializes the * simulation by populating the world. You must use these structures * as defined and in the way intended. This partial header file also * includes the prototypes of three functions that you must implement. * You may not change the prototypes of these functions. * * Your actual header file wator.h will include, of course, any * additional structures or function prototypes that you need * for your simulation module. We are specifying this much since it * is needed to specify the interface between your program and the * creation.o module. * ***********************************************************/ /************************************************************ * * The number of rows and columns in the array that models * Wa-Tor's ocean. * ***********************************************************/ #define ROWS 15 #define COLS 15 /************************************************************ * * The structures for a shark and tuna are the same and have the * following fields: * is: TRUE if there is a thing of this type in the cell and * FALSE otherwise. * reproduce: the number of timeClicks until the fish can * reproduce when it moves. Actual reproduction resets * this to the appropriate initial value. * starve: the number of timeClicks until the fish starves * to death unless it eats. Eating resets this to the * appropriate initial value. * timeLastMoved: the timeClick when the fish last moved. Needed * to ensure that a fish only gewts to move once in each step. * age: the number of timeClicks since the fish was born * ***********************************************************/ typedef struct shark { int is; int reproduce; int starve; int timeLastMoved; int age; }SHARK; typedef struct tuna { int is; int reproduce; int starve; int timeLastMoved; int age; }TUNA; /************************************************************ * * The structures for algae have the following fields: * is: TRUE iff there is an alga in the cell. * grow: the number of timeClicks until the alga can grow * into an adjacent empty cell. Reset when the alga does grow. * ***********************************************************/ typedef struct alga { int is; int grow; }ALGA; /************************************************************ * * The ocean is modeled by an array of CELLs. Each one has a * structure for the things that could be in a cell: a shark, a tuna * and an algae. * ***********************************************************/ typedef struct cell { SHARK s; TUNA t; ALGA a; }CELL; /************************************************************ * * Called to get the initial number of sharks, tuna and algae * to add to the model. * * INPUTS: pointers to the variables the caller uses for * these three values. Note we are using call by reference. * OUTPUT: While the function does not return a value, it does * put the three values read from the user into the addresses * of the variables passed as inputs. Did we mention that we're * using call by reference? * ***********************************************************/ void GetNumberOfIndividuals (int* pNumSharks, int* pNumTunas, int* pNumAlgae); /************************************************************ * * Called to get the five value governing the behaviour of sharks, * tuna and algae, namely shark starvation time, tuna starvation time, * shark reproduction time, tuna reproduction time, and the time * needed for algae to grow. * * INPUTS: pointers to the five variables the caller uses for * these five values. Note we are using call by reference. * OUTPUT: While the function does not return a value, it does * put the five values read from the user into the addresses * of the variables passed as inputs. Did we mention that we're * using call by reference? * ***********************************************************/ void GetLifeformTimes (int* pStarveShark, int* pStarveTuna, int* pReproShark, int* pReproTuna, int* pGrow); /************************************************************ * * Called to get the three values governing the overall simulation, * namely the inital random seed, the humber of timeClicks in * each eopc, and the total number of timeClicks for the simulation * run. * * INPUTS: pointers to the three variables the caller uses for * these three values. Note we are using call by reference. * OUTPUT: While the function does not return a value, it does * put the three values read from the user into the addresses * of the variables passed as inputs. Did we mention that we're * using call by reference? * ***********************************************************/ void GetSimulationSpecs (int* pSeed, int* pInterval, int* pTotalTime);