Class Symbiont

Inheritance Relationships

Base Type

Derived Types

Class Documentation

class Symbiont : public Organism

Subclassed by EfficientSymbiont, PGGSymbiont, Phage

Public Functions

Symbiont(emp::Ptr<emp::Random> _random, emp::Ptr<SymWorld> _world, emp::Ptr<SymConfigBase> _config, double _intval = 0.0, double _points = 0.0)

The constructor for symbiont

Symbiont(const Symbiont&) = default

Input: None

Output: None

Purpose: To force a copy constructor to be generated by the compiler.

Symbiont(Symbiont&&) = default

Input: None

Output: None

Purpose: To force a move constructor to be generated by the compiler

Symbiont() = default

Input: None

Output: None

Purpose: To tell the compiler to use its default generated variants of the constructor

Symbiont &operator=(const Symbiont&) = default

Input: None

Output: None

Purpose: To force a copy assignment operator to be generated by the compiler.

Symbiont &operator=(Symbiont&&) = default

Input: None

Output: None

Purpose: To force a move assignment operator to be generated by the compiler.

~Symbiont()

Input: None

Output: None

Purpose: To destruct the symbiont and remove the symbiont from the systematic.

std::string const GetName()

Input: None

Output: Name of class as string, Symbiont

Purpose: To know which subclass the object is

double GetIntVal() const

Input: None

Output: The double representing the symbiont’s interaction value

Purpose: To get a symbiont’s interaction value.

double GetPoints()

Input: None

Output: The double representing the symbiont’s points

Purpose: To get a symbiont’s points.

bool IsPhage()

Input: None

Output: The bool representing if a symbiont is a phage

Purpose: To determine if a symbiont is a phage

bool IsHost()

Input: None

Output: The bool representing if a symbiont is a host

Purpose: To determine if a symbiont is a host

double GetInfectionChance()

Input: None

Output: The chance of a symbiont infecting a parallel host during process

Purpose: To determine a symbiont’s infection chance

emp::Ptr<Organism> GetHost()

Input: None

Output: The pointer to a symbiont’s host

Purpose: To retrieve a symbiont’s host

emp::Ptr<emp::Taxon<int>> GetTaxon()

Input: None

Output: The pointer to the symbiont’s taxon

Purpose: To retrieve the symbiont’s taxon

void SetTaxon(emp::Ptr<emp::Taxon<int>> _in)

Input: A pointer to the taxon that this organism should belong to.

Output: None

Purpose: To set the symbiont’s taxon

void SetDead()

Input: None

Output: None

Purpose: To set a symbiont to dead

bool GetDead()

Input: None

Output: The bool representing if a symbiont is dead

Purpose: To determine if a symbiont is dead

void SetIntVal(double _in)

Input: The double representing the new interaction value of a symbiont

Output: None

Purpose: To set a symbiont’s interaction value

void SetPoints(double _in)

Input: The double representing the points to be set as a symbinot’s points

Output: None

Purpose: To set a symbiont’s points

void AddPoints(double _in)

Input: The double representing the points to be added to a symbinot’s points

Output: None

Purpose: To increment a symbiont’s points

int GetAge()

Input: None

Output: an int representing the current age of the Symbiont

Purpose: To get the Symbiont’s age.

void SetAge(int _in)

Input: An int of what age the Symbiont should be set to

Output: None

Purpose: To set the Symbiont’s age for testing purposes.

void SetHost(emp::Ptr<Organism> _in)

Input: The pointer to an organism that will be set as the symbinot’s host

Output: None

Purpose: To set a symbiont’s host

void SetInfectionChance(double _in)

Input: The double that will be the symbiont’s infection chance

Output: None

Purpose: To set a symbiont’s infection host and check that the proposed value is valid.

void UponInjection()

Input: None

Output: None

Purpose: Does nothing for now, added for backwards compatibility from phage to symbiont

void GrowOlder()

Input: None

Output: None

Purpose: Increments age by one and kills it if too old.

void Mutate()

Input: None

Output: None

Purpose: To mutate a symbiont’s interaction value. The mutation value is chosen from a normal distribution centered on 0 with the mutation size as the standard deviation.

double ProcessResources(double host_donation, emp::Ptr<Organism> host = nullptr)

Input: The double representing the resources to be distributed to the symbiont and (optionally) the host from whom it comes; if no host is provided, the symbiont’s host variable is used.

Output: The double representing the host’s resources

Purpose: To process and distribute resources.

bool WantsToInfect()

Input: None

Output: The boolean representing if a symbiont will seek out to infect a host.

Purpose: To determine if a symbiont wants to infect a host based upon its infection chance

bool InfectionFails()

Input: None

Output: The boolean representing if a symbiont will survive crossing over into the host world.

Purpose: To determine if a symbiont will survive crossing over into the host world based on infection risk.

void LoseResources(double resources)

Input: The double representing the resources given by the world.

Output: None

Purpose: Free living symbionts specialized to interact with hosts (extreme interaction value in either direction) lose some of the resources that they get from the world.

void Process(emp::WorldPosition location)

Input: The size_t representing the location of the symbiont, and the size_t representation of the symbiont’s position in the host (default -1 if it doesn’t have a host)

Output: None

Purpose: To process a symbiont, meaning to check for reproduction, distribute resources, and to allow for movement

emp::Ptr<Organism> MakeNew()

Input: None

Output: The pointer to the newly created organism

Purpose: To produce a new symbiont, identical to the original

emp::Ptr<Organism> Reproduce()

Input: None

Output: The pointer to the newly created organism

Purpose: To produce a new symbiont; does not remove resources from the parent, assumes that is handled by calling function

void VerticalTransmission(emp::Ptr<Organism> host_baby)

Input: The pointer to the organism that is the new host baby

Output: None

Purpose: To allow for vertical transmission to occur

void HorizontalTransmission(emp::WorldPosition location)

Input: The location of the organism (and it’s Host) as a size_t

Output: None

Purpose: To check and allow for horizontal transmission to occur

Protected Attributes

double interaction_val = 0

Purpose: Represents the interaction value between the host and symbiont. A negative interaction value represent antagonism, while a positive one represents mutualism. Zero is a neutral value.

double points = 0

Purpose: Represents the resource points possessed by a symbiont. This is what host’s must collect to reproduce.

bool dead = false

Purpose: Represents if a symbiont is alive. This is set to true when a symbiont is killed.

double infection_chance = 0.0

Purpose: Represents the chance (between 0 and 1) that a free-living sym will infect a parallel host on process

int age = 0

Purpose: Represents the number of updates the symbiont has lived through; at birth is set to 0.

emp::Ptr<emp::Random> random = NULL

Purpose: Represents an instance of random.

emp::Ptr<SymWorld> my_world = NULL

Purpose: Represents the world that the hosts are living in.

emp::Ptr<Organism> my_host = NULL

Purpose: Represents the symbiont’s host.

emp::Ptr<SymConfigBase> my_config = NULL

Purpose: Represents the configuration settings for a particular run.

emp::Ptr<emp::Taxon<int>> my_taxon = NULL

Purpose: Tracks the taxon of this organism.