|
7 | 7 | #include "SGPSymbiont.h" |
8 | 8 | #include "SGPWorld.h" |
9 | 9 |
|
| 10 | + |
| 11 | +/** |
| 12 | + * Input: A pointer to a long for the number of hosts to add to the world |
| 13 | + * |
| 14 | + * Output: None |
| 15 | + * |
| 16 | + * Purpose: Adds a number of hosts of a set type to the world. |
| 17 | + */ |
10 | 18 | void SGPWorld::SetupHosts(unsigned long *POP_SIZE) { |
11 | 19 | for (size_t i = 0; i < *POP_SIZE; i++) { |
12 | 20 | emp::Ptr<SGPHost> new_org; |
@@ -59,6 +67,14 @@ void SGPWorld::SendToGraveyard(emp::Ptr<Organism> org) { |
59 | 67 | SymWorld::SendToGraveyard(org); |
60 | 68 | } |
61 | 69 |
|
| 70 | + |
| 71 | +/** |
| 72 | + * Input: An id for the the parent symbiont and a pointer to that symbiont. |
| 73 | + * |
| 74 | + * Output: The id of a host that can be infected by the symbiont |
| 75 | + * |
| 76 | + * Purpose: Searches through up to 10 hosts in the world to find a host that the symbiont can infect. |
| 77 | + */ |
62 | 78 | int SGPWorld::GetNeighborHost (size_t id, emp::Ptr<Organism> symbiont){ |
63 | 79 | // Attempt to find host that matches some tasks |
64 | 80 | for (int i = 0; i < 10; i++) { |
@@ -129,7 +145,14 @@ bool SGPWorld::TaskMatchCheck(emp::Ptr<Organism> sym_parent, emp::Ptr<Organism> |
129 | 145 | } |
130 | 146 |
|
131 | 147 |
|
132 | | - |
| 148 | + /** |
| 149 | + * Input: Pointers to a symbiont offspring and the position of the symbiont's parent. |
| 150 | + * |
| 151 | + * Output: Returns a WorldPosition pointer, a valid one for succesful |
| 152 | + * infection and an invalid for a failed infection |
| 153 | + * |
| 154 | + * Purpose: To get the location of where the symbiont offpsring can be added to. |
| 155 | + */ |
133 | 156 | emp::WorldPosition SGPWorld::SymDoBirth(emp::Ptr<Organism> sym_baby, emp::WorldPosition parent_pos) { |
134 | 157 | size_t i = parent_pos.GetPopID(); |
135 | 158 | emp::Ptr<Organism> parent = GetOrgPtr(i)->GetSymbionts()[parent_pos.GetIndex()-1]; |
|
0 commit comments