Skip to content

Commit b83402d

Browse files
committed
something
1 parent 0766d6a commit b83402d

5 files changed

Lines changed: 23 additions & 13 deletions

File tree

source/default_mode/Host.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ class Host: public Organism {
768768

769769
host_baby->Mutate();
770770
host_baby->SetReproCount(reproductions + 1);
771-
AddPoints(-1 * my_config->HOST_REPRO_RES());
771+
this->AddPoints(-1 * my_config->HOST_REPRO_RES());
772772

773773
if (my_config->TAG_MATCHING() && HasSym()) {
774774
// do not xor to get 1 where bits are matching

source/default_mode/Symbiont.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,15 @@ class Symbiont: public Organism {
821821

822822

823823
if(!my_config->TAG_MATCHING() && !my_config->FREE_HT_FAILURE()) {
824-
AddPoints(-1 * my_config->SYM_HORIZ_TRANS_RES());
824+
if (my_config->FREE_LIVING_SYMS() && my_host == nullptr && my_config->FREE_SYM_REPRO_RES() > -1) {
825+
this->AddPoints(-1 * my_config->FREE_SYM_REPRO_RES());
826+
} else {
827+
this->AddPoints(-1 * my_config->SYM_HORIZ_TRANS_RES());
828+
}
829+
}
830+
831+
if(points != 0) {
832+
std::cout << "under: " << points << std::endl;
825833
}
826834
// removing the above for tag matching--sym parent points are
827835
// now set to 0 in symdobirth

source/test/default_mode_test/Host.test.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,12 +491,14 @@ TEST_CASE("Host Reproduce", "[default]") {
491491

492492
double host_int_val = 0.2;
493493
emp::Ptr<Organism> host1 = emp::NewPtr<Host>(random, &world, &config, host_int_val);
494+
host1->SetPoints(20);
495+
config.HOST_REPRO_RES(10);
494496
emp::Ptr<Organism> host2 = host1->Reproduce();
495497
THEN("The host baby has mutated interaction value") {
496498
REQUIRE(host1->GetIntVal() != host2->GetIntVal());
497499
}
498-
THEN("The host parent's points are set to 0") {
499-
REQUIRE(host1->GetPoints() == 0);
500+
THEN("The host parent's points are subtracted") {
501+
REQUIRE(host1->GetPoints() == 10);
500502
}
501503

502504
host1.Delete();

source/test/default_mode_test/SymWorld.test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -556,8 +556,8 @@ TEST_CASE( "SymDoBirth", "[default]" ) {
556556
symbiont_parent->SetPoints(starting_resources);
557557
symbiont_parent->IndependentReproduction(emp::WorldPosition(1, host_pos));
558558

559-
THEN("the sym child is inserted nowhere and the parent's points get set to 0") {
560-
REQUIRE(symbiont_parent->GetPoints() == 0);
559+
THEN("the sym child is inserted nowhere and the parent's points get subtracted") {
560+
REQUIRE(symbiont_parent->GetPoints() == 10);
561561
REQUIRE(host->GetSymbionts().size() == 1);
562562
REQUIRE(host->GetSymbionts().at(0) == symbiont_parent);
563563
}

source/test/default_mode_test/Symbiont.test.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ TEST_CASE("reproduce", "[default]") {
458458
random.Delete();
459459
}
460460

461-
TEST_CASE("Process", "[default]") {
461+
TEST_CASE("Process", "[default][Test]") {
462462
using sym_world_t = test_utils::TestingWorldWrapper<SymWorld>;
463463
emp::Ptr<emp::Random> random = emp::NewPtr<emp::Random>(10);
464464
SymConfigBase config;
@@ -482,8 +482,8 @@ TEST_CASE("Process", "[default]") {
482482
sym->Process(location);
483483

484484

485-
THEN("Points changes and is set to 0") {
486-
int points_post_reproduction = 0;
485+
THEN("Points are subtracted") {
486+
int points_post_reproduction = 60;
487487
REQUIRE(sym->GetPoints() == points_post_reproduction);
488488
}
489489

@@ -590,9 +590,9 @@ TEST_CASE("Process", "[default]") {
590590
sym->AddPoints(orig_points);
591591
sym->Process(location);
592592

593-
THEN("The free living symbiont reproduces and sets its points to 0") {
593+
THEN("The free living symbiont reproduces and subtracts the correct amount of points") {
594594
REQUIRE(world->GetNumOrgs() == (orig_num_orgs + 1));
595-
REQUIRE(sym->GetPoints() == 0);
595+
REQUIRE(sym->GetPoints() == 10);
596596
}
597597
}
598598
}
@@ -622,9 +622,9 @@ TEST_CASE("Process", "[default]") {
622622
sym->AddPoints(orig_points);
623623
sym->Process(location);
624624

625-
THEN("The free living symbiont reproduces and sets its points to 0") {
625+
THEN("The free living symbiont reproduces and subtracts the correct amount of points") {
626626
REQUIRE(world->GetNumOrgs() == (orig_num_orgs + 1));
627-
REQUIRE(sym->GetPoints() == 0);
627+
REQUIRE(sym->GetPoints() == 10);
628628
}
629629
}
630630
}

0 commit comments

Comments
 (0)