|
| 1 | + |
| 2 | +#include "../ConfigSetup.h" |
| 3 | +#include "../default_mode/DataNodes.h" |
| 4 | +#include "../default_mode/Host.h" |
| 5 | +#include "../default_mode/Symbiont.h" |
| 6 | + |
| 7 | +#include "../sgp_mode/hardware/SGPHardwareSpec.h" |
| 8 | +#include "../sgp_mode/SGPConfigSetup.h" |
| 9 | +#include "../sgp_mode/SGPWorld.h" |
| 10 | +#include "../antibiotic-mode/Human.h" |
| 11 | +#include "../antibiotic-mode/AntibioticConfigSetup.h" |
| 12 | +#include "symbulation.h" |
| 13 | + |
| 14 | +// Empirical doesn't support more than one translation unit, so any CC files are |
| 15 | +// included last. It still fixes include issues, but doesn't improve build time. |
| 16 | +#include "../default_mode/WorldSetup.cc" |
| 17 | +#include "../sgp_mode/SGPWorldSetup.cc" |
| 18 | +#include "../../Empirical/include/emp/config/ArgManager.hpp" |
| 19 | + |
| 20 | +#include <fstream> |
| 21 | +#include <iostream> |
| 22 | +#include <memory> |
| 23 | +#include <string> |
| 24 | + |
| 25 | +#include "../default_mode/WorldSetup.cc" |
| 26 | +#include "../sgp_mode/SGPWorld.cc" |
| 27 | +#include "../sgp_mode/SGPWorldSetup.cc" |
| 28 | +#include "../sgp_mode/SGPWorldData.cc" |
| 29 | +#include "../sgp_mode/SGPW_InteractionMechanismSetup.cc" |
| 30 | +#include "../sgp_mode/SGPW_TaskProfileSetup.cc" |
| 31 | + |
| 32 | +// This is the main function for the NATIVE version of this project. |
| 33 | + |
| 34 | +int symbulation_main(int argc, char *argv[]) { |
| 35 | + |
| 36 | + antibioticmode::AntibioticConfig config; |
| 37 | + CheckConfigFile(config, argc, argv); |
| 38 | + config.LIMITED_RES_TOTAL(10); |
| 39 | + config.LIMITED_RES_INFLOW(10); //TODO: go change these defaults in the custom config? |
| 40 | + config.WORLD_WIDTH(10); |
| 41 | + config.WORLD_HEIGHT(10); |
| 42 | + |
| 43 | + |
| 44 | + emp::Random random(config.SEED()); |
| 45 | + |
| 46 | + antibioticmode::Human human(random, &config); |
| 47 | + |
| 48 | + using sgp_host_t = sgpmode::SGPWorld::sgp_host_t; |
| 49 | + using sgp_sym_t = sgpmode::SGPWorld::sgp_sym_t; |
| 50 | + emp::Ptr<sgpmode::SGPWorld> human_micro = human.GetMicrobiome(); |
| 51 | + |
| 52 | + fun_sym_do_birth = [this]( |
| 53 | + emp::Ptr<sgp_sym_t> sym_baby_ptr, |
| 54 | + const emp::WorldPosition& parent_pos |
| 55 | + ) -> emp::WorldPosition { |
| 56 | + return FreeLivingSymDoBirth(sym_baby_ptr, parent_pos); |
| 57 | + } |
| 58 | + human_micro->SetCheckSymIndependentReproReqsFunctor([human_micro]( |
| 59 | + emp::Ptr<sgp_host_t> host, |
| 60 | + emp::Ptr<sgp_sym_t> symbiont) { |
| 61 | + //Hosts pay the cost instead of symbionts |
| 62 | + return host->GetPoints() >= 1; // TODO: change to using config that is captured |
| 63 | + }); |
| 64 | + |
| 65 | + human_micro->SetPaySymIndependentReproCostFunctor([](sgp_sym_t& symbiont) { |
| 66 | + //Hosts pay the cost instead of symbionts |
| 67 | + symbiont.GetHost()->AddPoints(-1); |
| 68 | + }); |
| 69 | + |
| 70 | + human_micro->SetApplySymOutputPointsFunctor([](sgp_sym_t& symbiont, double total_points) { |
| 71 | + symbiont.GetHost()->AddPoints(-total_points); //Hosts pays the cost of the task |
| 72 | + }); |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | + return 0; |
| 79 | +} |
| 80 | + |
| 81 | +/* |
| 82 | +This definition guard prevents main from being defined twice during testing. |
| 83 | +In testing, Catch will define a main function which will initiate tests |
| 84 | +(including testing the symbulation_main function above). |
| 85 | +*/ |
| 86 | +#ifndef CATCH_CONFIG_MAIN |
| 87 | +int main(int argc, char *argv[]) { return symbulation_main(argc, argv); } |
| 88 | +#endif |
0 commit comments