Unformatted text preview:

Programming assignment 6 you must work as a team of 2 or 3 members Division of responsibilities should be decided and turned in by Oct 23 Required Classes You must implement the following classes List class This class should implement a singly linked list of generic objects hence it should be a template The class should support the following interface o List GotoHead Return the generic object at the head of the list o List Add Add an item to the head of the list o List Delete Delete a specific item from the list o List NextItem Return the next item from the list Instantiations of List Gene and List Creature will serve as a data members within the DNA and Ecosystem classes respectively see below class This simple class should implement a tiny bit of genetic information Basically a gene will be simulated by a single floating point number that can take on values from 1 0 to 1 0 inclusively A single gene encodes a single behavioral parameter such as metatabolic rate or speed of movement Gene The mapping from a genetic value between 1 0 and 1 0 and a behavioral property such as metabolic rate is straightforward and linear The general form is the following X VALUE X MEAN X RANGE Y where X VALUE The value of a behavioral property for a specific individual creature X MEAN The mean value of this behavioral property across all individuals of a particular species X RANGE The range plus or minus of this behavior property across all individuals of a particular species Y The genetic value associated with this behavioral property for this particular individual creature As an example consider the behavior property that determines the metabolic rate for the Grazer species For one particular simulation you might wish to specify that the metabolic rate of the Grazer species must lie between say 3 0 and 7 0 energy units per time unit In this case you would set GRAZER METABOLIC RATE MEAN 5 0 and GRAZER METABOLIC RANGE 2 0 Then a particular individual member of the Grazer species might have a genetic value of Y 0 5 for it s Gene associated with metabolic rate Therefore this individual Grazer would have a metabolic rate of GRAZER METABOLIC RATE VALUE 5 0 0 5 2 0 4 0 The important point is that behavior property means and ranges are constant and specieswide whereas the behavior property values are different for each individual of the species depending upon the particular value of that individual s Gene associated with the behavior property The species wide behavior property means and ranges are specified prior to the beginning of the simulation via an input file the genetic values of the individuals within the species are randomly initialized to values between 1 0 and 1 0 at the beginning of the simulation As the simulation runs offspring will be born with genetic values determined to a large extent by their parents genetic information as described below The Gene class would be trivial equivalent to a floating point were it not for the occurence of small genetic perturbations and large mutations during the reproductive process So the Gene class must include member functions that support both asexual and sexual reproduction In this simulation genes are altered i e the floating point value changes in two ways during the reproductive process o Small perturbations In this case the floating point value of the Gene should be perturbed by a random value between 1 0 eco perturb par and 1 0 eco perturb par where eco perturb par is a global Ecosystem parameter If such a random perturbation results in the genetic value increasing beyond 1 0 or decreasing below 1 0 then the genetic value should simply be set equal to 1 0 or 1 0 respectively o Large Mutations Each time a gene is passed on during the reproductive process there is a possibility that it will undergo a severe mutation The probability of such a mutation occurring is specified by the global Ecosystem parameter eco mutate par If such a mutation does in fact occur then the gene passed to the offspring takes on a completely random value between 1 0 and 1 0 Specifically there should be a member function Gene Asexual that returns a perturbed and possibly mutated version of itself This member function should first check to see if a mutation occurs if so then it returns Gene with a completely mutated value If no mutation occurs then this member function should return a Gene containing a perturbed version of the original gene There should also be a member function Gene Sexual to support a more advanced and enjoyable form of reproduction This member function should first check whether or not mutation occurred and if so then it should simply return a completely mutated Gene same as in asexual reproduction If no mutation occurred then this member function should return a random value between it s own value and the genetic value of a second Gene object passed to the member function as an argument By convention the Gene Sexual member function associated with the mother creature should be called giving the Gene object associated with the father creature as an argument class DNA The complete genetic encoding of an individual creature will be stored in an object of class DNA A DNA object is essentially an ordered list of Gene objects Each species of Creature will interpret the floating point values associated with the individual Gene objects within a DNA object in a particular manner For example in your particular implementation a Roamer creature may interpret the value stored in it s seventh Gene as it s metabolic rate whereas a Grazer creature may interpret the value stored in it s seventh Gene as the range of it s sense of smell However the point is that from the point of view of the DNA and Gene objects the actual behavioral intepretation of the floating point genetic values is irrelevant The DNA class is merely a vehicle for passing on raw genetic information from one generation to the next with slight perturbations and the occasional mutation Consequently the DNA class should implement DNA Asexual and DNA Sexual member functions that apply the respective modes of reproduction to the constituent Gene objects returning a new DNA object Again DNA Sexual should follow the convention that the father s DNA object should be passed to the member function associated with the mother s DNA which returns a new DNA object destined for the new offspring Ecosystem class The Ecosystem class provides the basic environment in which the various creatures exist The Ecosystem class


View Full Document

SMU CSE 2341 - Programming

Loading Unlocking...
Login

Join to view Programming and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Programming and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?