@@ -11,6 +11,7 @@ namespace sgpmode {
1111 // These are defined in SGPW_TaskProfileSetup
1212 SetupTaskProfileMode ();
1313 SetupTaskProfileCompatibilityMode ();
14+ SetupInteractionCompatibilityMode ();
1415 SetupHorizontalTransmissionCompatibilityMode ();
1516
1617 SetupFindHostForHorizontalTransmission ();
@@ -79,10 +80,7 @@ namespace sgpmode {
7980 if (sym.GetDead ()) { return ; }
8081 // Will sym donate?
8182 bool interact = random_ptr->P (sgp_config.HEALTH_INTERACTION_CHANCE ());
82-
83- const auto & host_task_profile = fun_get_host_task_profile (host);
84- const auto & sym_task_profile = fun_get_sym_task_profile (sym);
85- interact = interact && fun_task_profile_compatibility_check (host_task_profile, sym_task_profile);
83+ interact = interact && fun_interaction_compatibility_check (host, sym);
8684
8785 const double donate_prop = sgp_config.MUTUALIST_CYCLE_GAIN_PROP ();
8886 emp_assert (donate_prop <= 1.0 && donate_prop >= 0.0 );
@@ -122,9 +120,7 @@ namespace sgpmode {
122120 auto & host_state = host.GetHardware ().GetCPUState ();
123121 // Will sym steal?
124122 bool interact = random_ptr->P (sgp_config.HEALTH_INTERACTION_CHANCE ());
125- const auto & host_task_profile = fun_get_host_task_profile (host);
126- const auto & sym_task_profile = fun_get_sym_task_profile (sym);
127- interact = interact && fun_task_profile_compatibility_check (host_task_profile, sym_task_profile);
123+ interact = interact && fun_interaction_compatibility_check (host, sym);
128124
129125 const double steal_prop = sgp_config.PARASITE_CYCLE_LOSS_PROP ();
130126 emp_assert (steal_prop <= 1.0 && steal_prop >= 0.0 );
@@ -162,9 +158,7 @@ namespace sgpmode {
162158 auto & host_state = host.GetHardware ().GetCPUState ();
163159 // Will host and symbiont interact?
164160 bool interact = random_ptr->P (sgp_config.HEALTH_INTERACTION_CHANCE ());
165- const auto & host_task_profile = fun_get_host_task_profile (host);
166- const auto & sym_task_profile = fun_get_sym_task_profile (sym);
167- interact = interact && fun_task_profile_compatibility_check (host_task_profile, sym_task_profile);
161+ interact = interact && fun_interaction_compatibility_check (host, sym);
168162 const double sym_interaction_value = sym.GetIntVal ();
169163 emp_assert (sym_interaction_value >= -1.0 );
170164 emp_assert (sym_interaction_value <= 1.0 );
@@ -240,7 +234,6 @@ namespace sgpmode {
240234 if (!stress_extinction_update) return ;
241235 // If host has a mutualist symbiont with a matching task profile, death_chance = mutualist death chance
242236 // Otherwise, base death chance.
243- const emp::BitVector& host_task_profile = fun_get_host_task_profile (host);
244237 bool interact = false ;
245238 auto & endosymbionts = host.GetSymbionts ();
246239 for (size_t sym_i = 0 ; sym_i < endosymbionts.size (); ++sym_i) {
@@ -250,7 +243,7 @@ namespace sgpmode {
250243 // host_task_profile,
251244 // fun_get_sym_task_profile(*endosym_ptr)
252245 // );
253- interact = fun_task_profile_compatibility_check (host_task_profile, fun_get_sym_task_profile ( *endosym_ptr) );
246+ interact = fun_interaction_compatibility_check (host, *endosym_ptr);
254247 if (interact) {
255248 break ;
256249 }
@@ -275,12 +268,11 @@ namespace sgpmode {
275268 // Otherwise, base death chance.
276269 double death_chance = sgp_config.BASE_DEATH_CHANCE ();
277270 auto & endosymbionts = host.GetSymbionts ();
278- const emp::BitVector& host_task_profile = fun_get_host_task_profile (host);
279271 for (size_t sym_i = 0 ; sym_i < endosymbionts.size (); ++sym_i) {
280272 // Check if symbiont matches task profile
281273 emp::Ptr<sgp_sym_t > endosym_ptr = static_cast <sgp_sym_t *>(endosymbionts[sym_i].Raw ());
282274 const emp::BitVector& endosym_task_profile = fun_get_sym_task_profile (*endosym_ptr);
283- const bool can_escape = fun_task_profile_compatibility_check (host_task_profile, fun_get_sym_task_profile ( *endosym_ptr) );
275+ const bool can_escape = fun_interaction_compatibility_check (host, *endosym_ptr);
284276 if (can_escape) {
285277 death_chance = sgp_config.PARASITE_DEATH_CHANCE ();
286278 // Endosymbiont gets opportunity to horizontally transmit
@@ -320,7 +312,7 @@ namespace sgpmode {
320312 for (size_t sym_i = 0 ; sym_i < endosymbionts.size (); ++sym_i) {
321313 // Check if symbiont matches task profile
322314 emp::Ptr<sgp_sym_t > endosym_ptr = static_cast <sgp_sym_t *>(endosymbionts[sym_i].Raw ());
323- const bool can_escape = fun_task_profile_compatibility_check (host_task_profile, fun_get_sym_task_profile ( *endosym_ptr) );
315+ const bool can_escape = fun_interaction_compatibility_check (host, *endosym_ptr);
324316 if (can_escape) {
325317 death_chance = sgp_config.PARASITE_DEATH_CHANCE ();
326318 escapee_ids.emplace_back (sym_i);
@@ -364,17 +356,16 @@ namespace sgpmode {
364356 before_host_cpu_exec_sig.AddAction (
365357 [this ](sgp_host_t & host) {
366358 if (!stress_extinction_update) return ;
367- const emp::BitVector& host_task_profile = fun_get_host_task_profile (host);
368359 emp::vector<size_t > escapee_ids; // Any parasite escapees?
369360 bool interact = false ;
370361 double endosym_interaction_value = 0.0 ;
371362 auto & endosymbionts = host.GetSymbionts ();
372363 for (size_t sym_i = 0 ; sym_i < endosymbionts.size (); ++sym_i) {
373364 // Check if symbiont matches task profile
374365 emp::Ptr<sgp_sym_t > endosym_ptr = static_cast <sgp_sym_t *>(endosymbionts[sym_i].Raw ());
375- interact = fun_task_profile_compatibility_check (
376- host_task_profile ,
377- fun_get_sym_task_profile ( *endosym_ptr)
366+ interact = fun_interaction_compatibility_check (
367+ host ,
368+ *endosym_ptr
378369 );
379370 if (interact) {
380371 endosym_interaction_value = endosym_ptr->GetIntVal ();
0 commit comments