@@ -36,6 +36,12 @@ class SymWorld : public emp::World<Organism> {
3636 using pop_t = typename emp::World<Organism>::pop_t ;
3737 using host_systematics_t = emp::Systematics<Organism, taxon_t ::info_t , datastruct::HostTaxonData>;
3838 using sym_systematics_t = emp::Systematics<Organism, taxon_t ::info_t , datastruct::SymbiontTaxonData>;
39+ using fun_check_sym_independent_repro_reqs_t = std::function<bool (
40+ Organism& /* symbiont */
41+ )>;
42+ using fun_pay_sym_independent_repro_cost_t = std::function<void (
43+ Organism& /* symbiont */
44+ )>;
3945
4046 enum class SPATIAL_STRUCT_MODE { WELL_MIXED , GRID , LOAD };
4147 static const std::unordered_map<std::string, SPATIAL_STRUCT_MODE > spatial_struct_mode_cfg_mapping;
@@ -86,6 +92,19 @@ class SymWorld : public emp::World<Organism> {
8692 */
8793 fun_calc_info_t calc_sym_info_fun;
8894
95+ /* *
96+ *
97+ * Purpose: Represents a standard function object which determines if a symbiont can reproduce independently.
98+ *
99+ */
100+ fun_check_sym_independent_repro_reqs_t fun_check_sym_independent_repro_reqs;
101+
102+ /* *
103+ *
104+ * Purpose: Represents a standard function object which pays the cost of independent reproduction for a symbiont.
105+ *
106+ */
107+ fun_pay_sym_independent_repro_cost_t fun_pay_sym_independent_repro_cost;
89108
90109 /* *
91110 *
@@ -269,6 +288,18 @@ class SymWorld : public emp::World<Organism> {
269288 if (my_config->TAG_MATCHING ()) {
270289 SetupTagMatching ();
271290 }
291+
292+ fun_check_sym_independent_repro_reqs = [](
293+ Organism& sym
294+ ) {
295+ return sym.MeetsIndependentReproRequirements ();
296+ };
297+
298+ fun_pay_sym_independent_repro_cost = [](
299+ Organism& sym
300+ ) {
301+ sym.PayIndependentReproCost ();
302+ };
272303 }
273304
274305
@@ -330,6 +361,23 @@ class SymWorld : public emp::World<Organism> {
330361 }
331362 }
332363
364+ /* Allow setting functor from native file*/
365+ void SetCheckSymIndependentReproReqsFunctor (fun_check_sym_independent_repro_reqs_t fun) {
366+ fun_check_sym_independent_repro_reqs = fun;
367+ }
368+
369+ bool CheckSymIndependentReproReqs (Organism& sym) {
370+ return fun_check_sym_independent_repro_reqs (sym);
371+ }
372+
373+ void SetPaySymIndependentReproCostFunctor (fun_pay_sym_independent_repro_cost_t fun) {
374+ fun_pay_sym_independent_repro_cost = fun;
375+ }
376+
377+ void PaySymIndependentReproCost (Organism& sym) {
378+ fun_pay_sym_independent_repro_cost (sym);
379+ }
380+
333381 /* *
334382 * Input: Boolean indicating whether world uses synchronous generations or not.
335383 *
0 commit comments