Lines Matching refs:m_organism

899   m_organism->SetRunning(true);  in SingleProcess()
902 m_organism->Die(ctx); in SingleProcess()
903 m_organism->SetRunning(false); in SingleProcess()
907 cPhenotype& phenotype = m_organism->GetPhenotype(); in SingleProcess()
941 m_organism->DoBreakpoint(); in SingleProcess()
956 m_organism->SetRunning(false); in SingleProcess()
1026 m_organism->Fault(FAULT_LOC_DEFAULT, FAULT_TYPE_ERROR); in SingleProcess()
1035 const int max_executed = m_organism->GetMaxExecuted(); in SingleProcess()
1038 else m_organism->Die(ctx); in SingleProcess()
1045 m_organism->SetRunning(false); in SingleProcess()
1059 if (m_organism->TestExeErr()) actual_inst = m_inst_set->GetRandomInst(ctx); in SingleProcess_ExecuteInst()
1066 m_organism->GetPhenotype().IncCurInstCount(actual_inst.GetOp()); in SingleProcess_ExecuteInst()
1075 if (m_organism->GetPhenotype().GetNumNewUniqueReactions()) { in SingleProcess_ExecuteInst()
1076 …int cost = m_organism->GetPhenotype().GetNumNewUniqueReactions() * m_world->GetConfig().TASK_SWITC… in SingleProcess_ExecuteInst()
1079 m_organism->GetPhenotype().ResetNumNewUniqueReactions(); in SingleProcess_ExecuteInst()
1085 m_organism->GetPhenotype().DecCurInstCount(actual_inst.GetOp()); in SingleProcess_ExecuteInst()
1095 bool prev_run_state = m_organism->IsRunning(); in ProcessBonusInst()
1096 m_organism->SetRunning(true); in ProcessBonusInst()
1102 m_organism->SetRunning(prev_run_state); in ProcessBonusInst()
1108 fp << m_organism->GetPhenotype().GetCPUCyclesUsed() << " "; in PrintStatus()
1116 if (m_organism->IsInterrupted()) { in PrintStatus()
1122 if (m_organism->GetPhenotype().GetTimeUsed() != m_organism->GetPhenotype().GetCPUCyclesUsed()) { in PrintStatus()
1123 …fp << " EnergyUsed:" << m_organism->GetPhenotype().GetTimeUsed(); // this is not energy that is u… in PrintStatus()
1661 m_organism->Fault(FAULT_LOC_ALLOC, FAULT_TYPE_ERROR, "Allocate already active"); in Allocate_Main()
1665 m_organism->Fault(FAULT_LOC_ALLOC, FAULT_TYPE_ERROR, in Allocate_Main()
1675 m_organism->Fault(FAULT_LOC_ALLOC, FAULT_TYPE_ERROR, in Allocate_Main()
1683 m_organism->Fault(FAULT_LOC_ALLOC, FAULT_TYPE_ERROR, in Allocate_Main()
1692 m_organism->Fault(FAULT_LOC_ALLOC, FAULT_TYPE_ERROR, in Allocate_Main()
1736 Sequence& child_genome = m_organism->OffspringGenome().GetSequence(); in Divide_Main()
1738 m_organism->OffspringGenome().SetHardwareType(GetType()); in Divide_Main()
1739 m_organism->OffspringGenome().SetInstSet(m_inst_set->GetInstSetName()); in Divide_Main()
1742 …if (m_world->GetConfig().REQUIRE_EXACT_COPY.Get() && (m_organism->GetGenome().GetSequence() != chi… in Divide_Main()
1770 bool parent_alive = m_organism->ActivateDivide(ctx); in Divide_Main()
1806 Sequence& child_genome = m_organism->OffspringGenome().GetSequence(); in Divide_MainRS()
1808 m_organism->OffspringGenome().SetHardwareType(GetType()); in Divide_MainRS()
1809 m_organism->OffspringGenome().SetInstSet(m_inst_set->GetInstSetName()); in Divide_MainRS()
1852 m_organism->GetPhenotype().ChildFertile() = false; in Divide_MainRS()
1871 bool parent_alive = m_organism->ActivateDivide(ctx); in Divide_MainRS()
1900 Sequence& child_genome = m_organism->OffspringGenome().GetSequence(); in Divide_Main1RS()
1902 m_organism->OffspringGenome().SetHardwareType(GetType()); in Divide_Main1RS()
1903 m_organism->OffspringGenome().SetInstSet(m_inst_set->GetInstSetName()); in Divide_Main1RS()
1942 m_organism->GetPhenotype().ChildFertile() = false; in Divide_Main1RS()
1960 bool parent_alive = m_organism->ActivateDivide(ctx); in Divide_Main1RS()
1989 Sequence& child_genome = m_organism->OffspringGenome().GetSequence(); in Divide_Main2RS()
1991 m_organism->OffspringGenome().SetHardwareType(GetType()); in Divide_Main2RS()
1992 m_organism->OffspringGenome().SetInstSet(m_inst_set->GetInstSetName()); in Divide_Main2RS()
2033 m_organism->GetPhenotype().ChildFertile() = false; in Divide_Main2RS()
2051 bool parent_alive = m_organism->ActivateDivide(ctx); in Divide_Main2RS()
2406 if (!m_organism->IsGermline()) { in Inst_IfGerm()
2415 if (m_organism->IsGermline()) { in Inst_IfSoma()
2442 m_organism->Fault(FAULT_LOC_JUMP, FAULT_TYPE_ERROR, in Inst_JumpF()
2467 m_organism->Fault(FAULT_LOC_JUMP, FAULT_TYPE_ERROR, in Inst_JumpB()
2494 m_organism->Fault(FAULT_LOC_JUMP, FAULT_TYPE_ERROR, in Inst_Call()
2846 m_organism->Fault(FAULT_LOC_MATH, FAULT_TYPE_ERROR, "sqrt: value is negative"); in Inst_Sqrt()
2859 m_organism->Fault(FAULT_LOC_MATH, FAULT_TYPE_ERROR, "log: value is negative"); in Inst_Log()
2872 m_organism->Fault(FAULT_LOC_MATH, FAULT_TYPE_ERROR, "log10: value is negative"); in Inst_Log10()
2912 m_organism->Fault(FAULT_LOC_MATH, FAULT_TYPE_ERROR, "div: Float exception"); in Inst_Div()
2916 m_organism->Fault(FAULT_LOC_MATH, FAULT_TYPE_ERROR, "div: dividing by 0"); in Inst_Div()
2930 m_organism->Fault(FAULT_LOC_MATH, FAULT_TYPE_ERROR, "mod: modding by 0"); in Inst_Mod()
3049 if (m_organism->TestCopyMut(ctx) && !(checkNoMutList(from))) { in Inst_Copy()
3088 if (m_organism->TestCopyMut(ctx) && !(checkNoMutList(to))) { in Inst_WriteInst()
3118 if (m_organism->TestCopyMut(ctx) && !(checkNoMutList(to))) { in Inst_StackWriteInst()
3143 if (m_organism->TestCopyMut(ctx) && !(checkNoMutList(from))) { in Inst_Compare()
3163 if (m_organism->TestCopyMut(ctx)) { in Inst_IfNCpy()
3252 Sequence& child_genome = m_organism->OffspringGenome().GetSequence(); in Divide_DoTransposons()
3273 cDeme* sourceDeme = m_organism->GetOrgInterface().GetDeme(); in Inst_ReproDeme()
3284 if (m_world->GetConfig().REPRO_METHOD.Get() == 0 && m_organism->IsNeighborCellOccupied()) { in Inst_Repro()
3288 if (m_organism->GetPhenotype().GetCurBonus() < m_world->GetConfig().REQUIRED_BONUS.Get()) { in Inst_Repro()
3293 Sequence& child_genome = m_organism->OffspringGenome().GetSequence(); in Inst_Repro()
3294 child_genome = m_organism->GetGenome().GetSequence(); in Inst_Repro()
3297 m_organism->OffspringGenome().SetHardwareType(GetType()); in Inst_Repro()
3298 m_organism->OffspringGenome().SetInstSet(m_inst_set->GetInstSetName()); in Inst_Repro()
3304 if (m_organism->GetCopyMutProb() > 0) { // Skip this if no mutations.... in Inst_Repro()
3314 if (m_organism->TestCopyMut(ctx) && !(in_list)) { in Inst_Repro()
3327 …bool viable = Divide_CheckViable(ctx, m_organism->GetGenome().GetSize(), m_organism->OffspringGeno… in Inst_Repro()
3344 const bool parent_alive = m_organism->ActivateDivide(ctx); in Inst_Repro()
3355 m_organism->GetPhenotype().SetDivideSex(true); in Inst_ReproSex()
3356 m_organism->GetPhenotype().SetCrossNum(1); in Inst_ReproSex()
3377 m_organism->DoOutput(ctx, value); in Inst_TaskPutRepro()
3399 if (m_organism->GetPhenotype().GetLastTaskID() == 0) { in Inst_ConditionalRepro()
3407 m_organism->SpawnDeme(ctx); in Inst_SpawnDeme()
3438 if (ctx.GetRandom().P(percent_prob)) m_organism->Kaboom(distance, ctx); in Inst_Kazi()
3466 if ( ctx.GetRandom().P(percent_prob) ) m_organism->Kaboom(distance, ctx); in Inst_Kazi5()
3473 m_organism->GetPhenotype().IsFertile() = false; in Inst_Sterilize()
3481 m_organism->Die(ctx); in Inst_Die()
3488m_organism->GetPhenotype().SetCurBonus(m_organism->GetPhenotype().GetCurBonus() * poison_multiplie… in Inst_Poison()
3500 if (m_organism->GetDeme() == NULL) return false; // in test CPU in Inst_Suicide()
3504 m_organism->GetDeme()->AddNumberOfPoints(m_world->GetConfig().DEMES_PROTECTION_POINTS.Get()); in Inst_Suicide()
3505 m_organism->GetDeme()->AddSuicide(); in Inst_Suicide()
3506 m_organism->Die(ctx); in Inst_Suicide()
3514 …double stored_energy = m_organism->GetPhenotype().GetStoredEnergy() * m_world->GetConfig().FRAC_EN… in Inst_RelinquishEnergyToFutureDeme()
3516 cDeme* deme = m_organism->GetOrgInterface().GetDeme(); in Inst_RelinquishEnergyToFutureDeme()
3520 m_organism->Die(ctx); in Inst_RelinquishEnergyToFutureDeme()
3526 …double stored_energy = m_organism->GetPhenotype().GetStoredEnergy() * m_world->GetConfig().FRAC_EN… in Inst_RelinquishEnergyToNeighborOrganisms()
3529 for (int i = 0; i < m_organism->GetNeighborhoodSize(); i++) { in Inst_RelinquishEnergyToNeighborOrganisms()
3530 if (m_organism->IsNeighborCellOccupied()) { in Inst_RelinquishEnergyToNeighborOrganisms()
3534 m_organism->Rotate(1); in Inst_RelinquishEnergyToNeighborOrganisms()
3537 for (int i = 0; i < m_organism->GetNeighborhoodSize(); i++) { in Inst_RelinquishEnergyToNeighborOrganisms()
3538 if (m_organism->IsNeighborCellOccupied()) { in Inst_RelinquishEnergyToNeighborOrganisms()
3540 m_organism->GetNeighbor()->GetPhenotype().EnergyTestament(stored_energy/numOcuppiedNeighbors); in Inst_RelinquishEnergyToNeighborOrganisms()
3542 m_organism->Rotate(1); in Inst_RelinquishEnergyToNeighborOrganisms()
3546 m_organism->Die(ctx); in Inst_RelinquishEnergyToNeighborOrganisms()
3553 …double stored_energy = m_organism->GetPhenotype().GetStoredEnergy() * m_world->GetConfig().FRAC_EN… in Inst_RelinquishEnergyToOrganismsInDeme()
3556 m_organism->DivideOrgTestamentAmongDeme(stored_energy); in Inst_RelinquishEnergyToOrganismsInDeme()
3558 m_organism->Die(ctx); in Inst_RelinquishEnergyToOrganismsInDeme()
3567 const int value = m_organism->GetNextInput(); in Inst_TaskGet()
3569 m_organism->DoInput(value); in Inst_TaskGet()
3578m_organism->GetOrgInterface().ResetInputs(ctx); // Now re-randomize the inputs this organism sees in Inst_TaskGet2()
3579m_organism->ClearInput(); // Also clear their input buffers, or they can s… in Inst_TaskGet2()
3585 const int value1 = m_organism->GetNextInput(); in Inst_TaskGet2()
3587 m_organism->DoInput(value1); in Inst_TaskGet2()
3589 const int value2 = m_organism->GetNextInput(); in Inst_TaskGet2()
3591 m_organism->DoInput(value2); in Inst_TaskGet2()
3598 const int value = m_organism->GetNextInput(); in Inst_TaskStackGet()
3600 m_organism->DoInput(value); in Inst_TaskStackGet()
3607 for (int i = 0; i < 3; i++) StackPush( m_organism->GetNextInput() ); in Inst_TaskStackLoad()
3616 m_organism->DoOutput(ctx, value); in Inst_TaskPut()
3623m_organism->GetOrgInterface().ResetInputs(ctx); // Now re-randomize the inputs this organism sees in Inst_TaskPutResetInputs()
3624m_organism->ClearInput(); // Also clear their input buffers, or they can s… in Inst_TaskPutResetInputs()
3635 m_organism->DoOutput(ctx, value_out); // Check for tasks completed. in Inst_TaskIO()
3638 const int value_in = m_organism->GetNextInput(); in Inst_TaskIO()
3640 m_organism->DoInput(value_in); in Inst_TaskIO()
3647 double new_bonus = m_organism->GetPhenotype().GetCurBonus() * (1 - bonus_cost); in Inst_TaskIO_BonusCost()
3650 m_organism->GetPhenotype().SetCurBonus(new_bonus); in Inst_TaskIO_BonusCost()
3660 double preOutputBonus = m_organism->GetPhenotype().GetCurBonus(); in Inst_TaskIO_Feedback()
3664 m_organism->DoOutput(ctx, value_out); // Check for tasks completed. in Inst_TaskIO_Feedback()
3667 double postOutputBonus = m_organism->GetPhenotype().GetCurBonus(); in Inst_TaskIO_Feedback()
3688 const int value_in = m_organism->GetNextInput(); in Inst_TaskIO_Feedback()
3690 m_organism->DoInput(value_in); in Inst_TaskIO_Feedback()
3697 m_organism->DoOutput(ctx, 357913941); in Inst_MatchStrings()
3708 m_organism->SellValue(send_value, search_label, sell_price); in Inst_Sell()
3717 GetRegister(REG_BX) = m_organism->BuyValue(search_label, buy_price); in Inst_Buy()
3725 m_organism->SendValue(GetRegister(reg_used)); in Inst_Send()
3734 GetRegister(reg_used) = m_organism->ReceiveValue(); in Inst_Receive()
3758 const tArray<double> res_count = m_organism->GetOrgInterface().GetResources(ctx) + in DoSense()
3759 m_organism->GetOrgInterface().GetDemeResources(m_organism->GetOrgInterface().GetDemeID(), ctx); in DoSense()
3853 m_organism->GetPhenotype().IncSenseCount(sensed_index); in DoSense()
3863 return DoSenseResourceX(REG_BX, m_organism->GetCellID(), 0, ctx); in Inst_SenseResource0()
3868 return DoSenseResourceX(REG_BX, m_organism->GetCellID(), 1, ctx); in Inst_SenseResource1()
3873 return DoSenseResourceX(REG_BX, m_organism->GetCellID(), 2, ctx); in Inst_SenseResource2()
3878 …return DoSenseResourceX(REG_BX, m_world->GetPopulation().GetCell(m_organism->GetCellID()).GetCellF… in Inst_SenseFacedResource0()
3883 …return DoSenseResourceX(REG_BX, m_world->GetPopulation().GetCell(m_organism->GetCellID()).GetCellF… in Inst_SenseFacedResource1()
3888 …return DoSenseResourceX(REG_BX, m_world->GetPopulation().GetCell(m_organism->GetCellID()).GetCellF… in Inst_SenseFacedResource2()
3912 const tArray<double> res_count = m_organism->GetOrgInterface().GetResources(ctx); in Inst_SenseResourceID()
3927 const tArray<double> res_count = m_organism->GetOrgInterface().GetResources(ctx); in Inst_SenseOpinionResourceQuantity()
3929 if(m_organism->GetOrgInterface().HasOpinion(m_organism)) { in Inst_SenseOpinionResourceQuantity()
3930 int opinion = m_organism->GetOpinion().first; in Inst_SenseOpinionResourceQuantity()
3947 if (!m_organism->GetOrgInterface().HasOpinion(m_organism)) return false; in Inst_SenseNextResLevel()
3949 int opinion = m_organism->GetOpinion().first; in Inst_SenseNextResLevel()
3951 const int num_groups = m_organism->GetOrgInterface().GetResources(ctx).GetSize(); in Inst_SenseNextResLevel()
3961 const tArray<double> res_count = m_organism->GetOrgInterface().GetResources(ctx); in Inst_SenseNextResLevel()
3979 const tArray<double> res_count = m_organism->GetOrgInterface().GetResources(ctx); in Inst_SenseDiffFaced()
3980 if(m_organism->GetOrgInterface().HasOpinion(m_organism)) { in Inst_SenseDiffFaced()
3981 int opinion = m_organism->GetOpinion().first; in Inst_SenseDiffFaced()
3983 double faced_res = m_organism->GetOrgInterface().GetFacedCellResources(ctx)[opinion]; in Inst_SenseDiffFaced()
4001 tArray<double> cell_resource_levels = m_organism->GetOrgInterface().GetFacedCellResources(ctx); in Inst_SenseFacedHabitat()
4042 int num_resources = m_organism->GetOrgInterface().GetResources(ctx).GetSize(); in FindModifiedResource()
4105 m_organism->IncCollectSpecCount(spec_id); in DoCollect()
4113 const tArray<double> res_count = m_organism->GetOrgInterface().GetResources(ctx); in DoActualCollect()
4116 double total = m_organism->GetRBinsTotal(); in DoActualCollect()
4146 m_organism->AddToRBin(bin_used, -1 * res_change[bin_used]); in DoActualCollect()
4154 m_organism->GetOrgInterface().UpdateResources(ctx, res_change); in DoActualCollect()
4205 double res_before = m_organism->GetRBin(resource); in Inst_CollectSpecific()
4207 double res_after = m_organism->GetRBin(resource); in Inst_CollectSpecific()
4215 if(!m_organism->IsNeighborCellOccupied())return false; in Inst_DonateSpecific()
4217 target = m_organism->GetOrgInterface().GetNeighbor(); in Inst_DonateSpecific()
4220 double res_before = m_organism->GetRBin(resource); in Inst_DonateSpecific()
4225 cBioGroup* bg = m_organism->GetBioGroup("genotype"); in Inst_DonateSpecific()
4236 m_organism->GetPhenotype().IncDonates(); in Inst_DonateSpecific()
4237 m_organism->GetOrgInterface().PushDonateSpecInstExe(ctx, target, kin); in Inst_DonateSpecific()
4246 assert(m_organism != 0); in Inst_CheckFacedKin()
4248 if (!m_organism->IsNeighborCellOccupied()) return false; in Inst_CheckFacedKin()
4249 cOrganism* neighbor =m_organism->GetOrgInterface().GetNeighbor(); in Inst_CheckFacedKin()
4259 cBioGroup* bg = m_organism->GetBioGroup("genotype"); in Inst_CheckFacedKin()
4279 assert(m_organism != 0); in Inst_CheckFacedBeggar()
4281 if (!m_organism->IsNeighborCellOccupied()) return false; in Inst_CheckFacedBeggar()
4282 cOrganism* neighbor =m_organism->GetOrgInterface().GetNeighbor(); in Inst_CheckFacedBeggar()
4295 assert(m_organism != 0); in Inst_IfFacedKin()
4297 if (!m_organism->IsNeighborCellOccupied()) return false; in Inst_IfFacedKin()
4298 cOrganism* neighbor = m_organism->GetOrgInterface().GetNeighbor(); in Inst_IfFacedKin()
4314 cBioGroup* bg = m_organism->GetBioGroup("genotype"); in Inst_IfFacedKin()
4332 assert(m_organism != 0); in Inst_IfFacedBeggar()
4334 if (!m_organism->IsNeighborCellOccupied()) return false; in Inst_IfFacedBeggar()
4335 cOrganism* neighbor =m_organism->GetOrgInterface().GetNeighbor(); in Inst_IfFacedBeggar()
4347 assert(m_organism != 0); in Inst_IfFacedBeggarAndNeedResource()
4349 if (!m_organism->IsNeighborCellOccupied()) return false; in Inst_IfFacedBeggarAndNeedResource()
4350 cOrganism* neighbor =m_organism->GetOrgInterface().GetNeighbor(); in Inst_IfFacedBeggarAndNeedResource()
4363 assert(m_organism != 0); in Inst_IfFacedBeggarAndKin()
4365 if (!m_organism->IsNeighborCellOccupied()) return false; in Inst_IfFacedBeggarAndKin()
4366 cOrganism* neighbor = m_organism->GetOrgInterface().GetNeighbor(); in Inst_IfFacedBeggarAndKin()
4385 cBioGroup* bg = m_organism->GetBioGroup("genotype"); in Inst_IfFacedBeggarAndKin()
4402 assert(m_organism != 0); in Inst_IfFacedKinAndNeedResource()
4404 if (!m_organism->IsNeighborCellOccupied()) return false; in Inst_IfFacedKinAndNeedResource()
4405 cOrganism* neighbor = m_organism->GetOrgInterface().GetNeighbor(); in Inst_IfFacedKinAndNeedResource()
4425 cBioGroup* bg = m_organism->GetBioGroup("genotype"); in Inst_IfFacedKinAndNeedResource()
4444 assert(m_organism != 0); in Inst_IfFacedNeedResource()
4446 if (!m_organism->IsNeighborCellOccupied()) return false; in Inst_IfFacedNeedResource()
4447 cOrganism* neighbor = m_organism->GetOrgInterface().GetNeighbor(); in Inst_IfFacedNeedResource()
4462 assert(m_organism != 0); in Inst_IfFacedKinAndBeggarAndNeedResource()
4464 if (!m_organism->IsNeighborCellOccupied()) return false; in Inst_IfFacedKinAndBeggarAndNeedResource()
4465 cOrganism* neighbor = m_organism->GetOrgInterface().GetNeighbor(); in Inst_IfFacedKinAndBeggarAndNeedResource()
4488 cBioGroup* bg = m_organism->GetBioGroup("genotype"); in Inst_IfFacedKinAndBeggarAndNeedResource()
4506 assert(m_organism != 0); in Inst_IfFacedKinAndBeggarAndNeedResourceThenDonate()
4508 if (!m_organism->IsNeighborCellOccupied()) return false; in Inst_IfFacedKinAndBeggarAndNeedResourceThenDonate()
4509 cOrganism* neighbor = m_organism->GetOrgInterface().GetNeighbor(); in Inst_IfFacedKinAndBeggarAndNeedResourceThenDonate()
4532 cBioGroup* bg = m_organism->GetBioGroup("genotype"); in Inst_IfFacedKinAndBeggarAndNeedResourceThenDonate()
4547 target = m_organism->GetOrgInterface().GetNeighbor(); in Inst_IfFacedKinAndBeggarAndNeedResourceThenDonate()
4549 double res_before = m_organism->GetRBin(resource); in Inst_IfFacedKinAndBeggarAndNeedResourceThenDonate()
4555 cBioGroup* bg = m_organism->GetBioGroup("genotype"); in Inst_IfFacedKinAndBeggarAndNeedResourceThenDonate()
4566 m_organism->GetPhenotype().IncDonates(); in Inst_IfFacedKinAndBeggarAndNeedResourceThenDonate()
4567 m_organism->GetOrgInterface().PushDonateSpecInstExe(ctx, target, kin); in Inst_IfFacedKinAndBeggarAndNeedResourceThenDonate()
4577 assert(m_organism != 0); in Inst_IfFacedBeggarANdNeedsResourceThenDonate()
4579 if (!m_organism->IsNeighborCellOccupied()) return false; in Inst_IfFacedBeggarANdNeedsResourceThenDonate()
4580 cOrganism* neighbor =m_organism->GetOrgInterface().GetNeighbor(); in Inst_IfFacedBeggarANdNeedsResourceThenDonate()
4590 target = m_organism->GetOrgInterface().GetNeighbor(); in Inst_IfFacedBeggarANdNeedsResourceThenDonate()
4592 double res_before = m_organism->GetRBin(resource); in Inst_IfFacedBeggarANdNeedsResourceThenDonate()
4598 cBioGroup* bg = m_organism->GetBioGroup("genotype"); in Inst_IfFacedBeggarANdNeedsResourceThenDonate()
4609 m_organism->GetPhenotype().IncDonates(); in Inst_IfFacedBeggarANdNeedsResourceThenDonate()
4610 m_organism->GetOrgInterface().PushDonateSpecInstExe(ctx, target, kin); in Inst_IfFacedBeggarANdNeedsResourceThenDonate()
4623 double res_amt = m_organism->GetRBin(resource); in Inst_FailIfEmpty()
4634 assert(m_organism != 0); in Inst_SetBeggar()
4635 m_organism->ChangeBeg(); in Inst_SetBeggar()
4646 const tArray<double> resources = m_organism->GetOrgInterface().GetResources(ctx) + in Inst_IfResources()
4647 m_organism->GetOrgInterface().GetDemeResources(m_organism->GetOrgInterface().GetDemeID(), ctx); in Inst_IfResources()
4675 double cur_merit = m_organism->GetPhenotype().GetMerit().GetDouble(); in DoDonate()
4680 m_organism->UpdateMerit(cur_merit); in DoDonate()
4681 m_organism->GetPhenotype().SetIsEnergyDonor(); in DoDonate()
4695 const double frac_energy_given = m_organism->GetFracEnergyDonating(); in DoEnergyDonate()
4697 cPhenotype& phenotype = m_organism->GetPhenotype(); in DoEnergyDonate()
4706 m_organism->UpdateMerit(senderMerit); in DoEnergyDonate()
4724 DoEnergyDonateAmount(to_org, m_organism->GetPhenotype().GetStoredEnergy() * frac_energy_given); in DoEnergyDonatePercent()
4741 cPhenotype& phenotype = m_organism->GetPhenotype(); in DoEnergyDonateAmount()
4753 m_organism->GetDeme()->IncreaseEnergyDonated(energy_given); in DoEnergyDonateAmount()
4757 m_organism->UpdateMerit(senderMerit); in DoEnergyDonateAmount()
4785 m_organism->GetID(), in DoEnergyDonateAmount()
4800 if (m_organism->GetPhenotype().GetCurNumDonates() > m_world->GetConfig().MAX_DONATES.Get()) { in Inst_DonateFacing()
4803 m_organism->GetPhenotype().IncDonates(); in Inst_DonateFacing()
4804 m_organism->GetPhenotype().SetIsDonorRand(); in Inst_DonateFacing()
4807 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_DonateFacing()
4821 if (m_organism->GetPhenotype().GetCurNumDonates() > m_world->GetConfig().MAX_DONATES.Get()) { in Inst_DonateRandom()
4825 m_organism->GetPhenotype().IncDonates(); in Inst_DonateRandom()
4826 m_organism->GetPhenotype().SetIsDonorRand(); in Inst_DonateRandom()
4829 int neighbor_id = ctx.GetRandom().GetInt(m_organism->GetNeighborhoodSize()); in Inst_DonateRandom()
4830 for (int i = 0; i < neighbor_id; i++) m_organism->Rotate(1); in Inst_DonateRandom()
4831 cOrganism* neighbor = m_organism->GetNeighbor(); in Inst_DonateRandom()
4832 for (int i = 0; i < neighbor_id; i++) m_organism->Rotate(-1); in Inst_DonateRandom()
4848 if (m_organism->GetPhenotype().GetCurNumDonates() > m_world->GetConfig().MAX_DONATES.Get()) { in Inst_DonateKin()
4852 m_organism->GetPhenotype().IncDonates(); in Inst_DonateKin()
4853 m_organism->GetPhenotype().SetIsDonorKin(); in Inst_DonateKin()
4857 const int num_neighbors = m_organism->GetNeighborhoodSize(); in Inst_DonateKin()
4861 for (int i = 0; i < neighbor_id; i++) m_organism->Rotate(1); in Inst_DonateKin()
4862 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_DonateKin()
4869 cBioGroup* bg = m_organism->GetBioGroup("genotype"); in Inst_DonateKin()
4878 neighbor = m_organism->GetNeighbor(); in Inst_DonateKin()
4887 m_organism->Rotate(1); in Inst_DonateKin()
4894 for (int i = 0; i < neighbor_id; i++) m_organism->Rotate(-1); in Inst_DonateKin()
4906 if (m_organism->GetPhenotype().GetCurNumDonates() > m_world->GetConfig().MAX_DONATES.Get()) { in Inst_DonateEditDist()
4910 m_organism->GetPhenotype().IncDonates(); in Inst_DonateEditDist()
4911 m_organism->GetPhenotype().SetIsDonorEdit(); in Inst_DonateEditDist()
4914 const int num_neighbors = m_organism->GetNeighborhoodSize(); in Inst_DonateEditDist()
4918 for (int i = 0; i < neighbor_id; i++) m_organism->Rotate(1); in Inst_DonateEditDist()
4919 cOrganism* neighbor = m_organism->GetNeighbor(); in Inst_DonateEditDist()
4927 neighbor = m_organism->GetNeighbor(); in Inst_DonateEditDist()
4930 edit_dist = Sequence::FindEditDistance(m_organism->GetGenome().GetSequence(), in Inst_DonateEditDist()
4937 const int edit_dist = Sequence::FindEditDistance(m_organism->GetGenome().GetSequence(), in Inst_DonateEditDist()
4963 m_organism->Rotate(1); in Inst_DonateEditDist()
4970 for (int i = 0; i < neighbor_id; i++) m_organism->Rotate(-1); in Inst_DonateEditDist()
4986 cPhenotype & phenotype = m_organism->GetPhenotype(); in Inst_DonateGreenBeardGene()
4988 if (m_organism->GetPhenotype().GetCurNumDonates() > m_world->GetConfig().MAX_DONATES.Get()) { in Inst_DonateGreenBeardGene()
4998 const int num_neighbors = m_organism->GetNeighborhoodSize(); in Inst_DonateGreenBeardGene()
5002 for (int i = 0; i < neighbor_id; i++) m_organism->Rotate(1); in Inst_DonateGreenBeardGene()
5003 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_DonateGreenBeardGene()
5013 neighbor = m_organism->GetNeighbor(); in Inst_DonateGreenBeardGene()
5036 m_organism->Rotate(1); in Inst_DonateGreenBeardGene()
5043 for (int i = 0; i < neighbor_id; i++) m_organism->Rotate(-1); in Inst_DonateGreenBeardGene()
5060 cPhenotype & phenotype = m_organism->GetPhenotype(); in Inst_DonateShadedGreenBeard()
5063 if (m_organism->GetPhenotype().GetCurNumDonates() > m_world->GetConfig().MAX_DONATES.Get()) { in Inst_DonateShadedGreenBeard()
5090 const int num_neighbors = m_organism->GetNeighborhoodSize(); in Inst_DonateShadedGreenBeard()
5097 for (int i = 0; i < neighbor_id; i++) m_organism->Rotate(1); in Inst_DonateShadedGreenBeard()
5098 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_DonateShadedGreenBeard()
5107 neighbor = m_organism->GetNeighbor(); in Inst_DonateShadedGreenBeard()
5122 const int edit_dist = Sequence::FindEditDistance(m_organism->GetGenome().GetSequence(), in Inst_DonateShadedGreenBeard()
5155 m_organism->Rotate(1); in Inst_DonateShadedGreenBeard()
5162 for (int i = 0; i < neighbor_id; i++) m_organism->Rotate(-1); in Inst_DonateShadedGreenBeard()
5183 cPhenotype & phenotype = m_organism->GetPhenotype(); in Inst_DonateTrueGreenBeard()
5185 if (m_organism->GetPhenotype().GetCurNumDonates() > m_world->GetConfig().MAX_DONATES.Get()) { in Inst_DonateTrueGreenBeard()
5195 const int num_neighbors = m_organism->GetNeighborhoodSize(); in Inst_DonateTrueGreenBeard()
5208 for (int i = 0; i < neighbor_id; i++) m_organism->Rotate(1); in Inst_DonateTrueGreenBeard()
5209 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_DonateTrueGreenBeard()
5218 neighbor = m_organism->GetNeighbor(); in Inst_DonateTrueGreenBeard()
5229 m_organism->Rotate(1); in Inst_DonateTrueGreenBeard()
5236 for (int i = 0; i < neighbor_id; i++) m_organism->Rotate(-1); in Inst_DonateTrueGreenBeard()
5256 cPhenotype & phenotype = m_organism->GetPhenotype(); in Inst_DonateThreshGreenBeard()
5258 if (m_organism->GetPhenotype().GetCurNumDonates() > m_world->GetConfig().MAX_DONATES.Get()) { in Inst_DonateThreshGreenBeard()
5282 const int num_neighbors = m_organism->GetNeighborhoodSize(); in Inst_DonateThreshGreenBeard()
5286 for (int i = 0; i < neighbor_id; i++) m_organism->Rotate(1); in Inst_DonateThreshGreenBeard()
5287 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_DonateThreshGreenBeard()
5296 neighbor = m_organism->GetNeighbor(); in Inst_DonateThreshGreenBeard()
5310 const int edit_dist = Sequence::FindEditDistance(m_organism->GetGenome().GetSequence(), in Inst_DonateThreshGreenBeard()
5352 m_organism->Rotate(1); in Inst_DonateThreshGreenBeard()
5359 for (int i = 0; i < neighbor_id; i++) m_organism->Rotate(-1); in Inst_DonateThreshGreenBeard()
5386 cPhenotype & phenotype = m_organism->GetPhenotype(); in Inst_DonateQuantaThreshGreenBeard()
5401 const int num_neighbors = m_organism->GetNeighborhoodSize(); in Inst_DonateQuantaThreshGreenBeard()
5405 for (int i = 0; i < neighbor_id; i++) m_organism->Rotate(1); in Inst_DonateQuantaThreshGreenBeard()
5406 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_DonateQuantaThreshGreenBeard()
5424 neighbor = m_organism->GetNeighbor(); in Inst_DonateQuantaThreshGreenBeard()
5448 m_organism->Rotate(1); in Inst_DonateQuantaThreshGreenBeard()
5455 for (int i = 0; i < neighbor_id; i++) m_organism->Rotate(-1); in Inst_DonateQuantaThreshGreenBeard()
5475 cPhenotype & phenotype = m_organism->GetPhenotype(); in Inst_DonateGreenBeardSameLocus()
5490 const int num_neighbors = m_organism->GetNeighborhoodSize(); in Inst_DonateGreenBeardSameLocus()
5494 for (int i = 0; i < neighbor_id; i++) m_organism->Rotate(1); in Inst_DonateGreenBeardSameLocus()
5495 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_DonateGreenBeardSameLocus()
5504 neighbor = m_organism->GetNeighbor(); in Inst_DonateGreenBeardSameLocus()
5515 m_organism->Rotate(1); in Inst_DonateGreenBeardSameLocus()
5522 for (int i = 0; i < neighbor_id; i++) m_organism->Rotate(-1); in Inst_DonateGreenBeardSameLocus()
5537 if (m_organism->GetPhenotype().GetCurNumDonates() > m_world->GetConfig().MAX_DONATES.Get()) { in Inst_DonateNULL()
5541 m_organism->GetPhenotype().IncDonates(); in Inst_DonateNULL()
5542 m_organism->GetPhenotype().SetIsDonorNull(); in Inst_DonateNULL()
5548 double cur_merit = m_organism->GetPhenotype().GetMerit().GetDouble(); in Inst_DonateNULL()
5552 m_organism->UpdateMerit(cur_merit); in Inst_DonateNULL()
5561 if (m_organism->GetCellID() < 0) { in Inst_ReceiveDonatedEnergy()
5565 cPhenotype& phenotype = m_organism->GetPhenotype(); in Inst_ReceiveDonatedEnergy()
5571 m_organism->UpdateMerit(receiverMerit); in Inst_ReceiveDonatedEnergy()
5583 if (m_organism->GetCellID() < 0) { in Inst_DonateEnergy()
5587 std::pair<bool, cOrgMessage> retrieved = m_organism->RetrieveMessage(); in Inst_DonateEnergy()
5608 DoEnergyDonatePercent(energyReceiver, m_organism->GetFracEnergyDonating()); in Inst_DonateEnergy()
5618 cPhenotype& phenotype = m_organism->GetPhenotype(); in Inst_UpdateMetabolicRate()
5620 m_organism->UpdateMerit(newmerit); in Inst_UpdateMetabolicRate()
5629 if (m_organism->GetCellID() < 0) { in Inst_DonateEnergyFaced()
5633 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_DonateEnergyFaced()
5639 DoEnergyDonatePercent(neighbor, m_organism->GetFracEnergyDonating()); in Inst_DonateEnergyFaced()
5650 if (m_organism->GetCellID() < 0) { in Inst_DonateEnergyFaced1()
5654 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_DonateEnergyFaced1()
5671 if (m_organism->GetCellID() < 0) { in Inst_DonateEnergyFaced2()
5675 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_DonateEnergyFaced2()
5692 if (m_organism->GetCellID() < 0) { in Inst_DonateEnergyFaced5()
5696 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_DonateEnergyFaced5()
5713 if (m_organism->GetCellID() < 0) { in Inst_DonateEnergyFaced10()
5717 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_DonateEnergyFaced10()
5734 if (m_organism->GetCellID() < 0) { in Inst_DonateEnergyFaced20()
5738 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_DonateEnergyFaced20()
5755 if (m_organism->GetCellID() < 0) { in Inst_DonateEnergyFaced50()
5759 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_DonateEnergyFaced50()
5776 if (m_organism->GetCellID() < 0) { in Inst_DonateEnergyFaced100()
5780 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_DonateEnergyFaced100()
5798 if (m_organism->GetCellID() < 0) { in Inst_RotateToMostNeedy()
5803 cPopulationCell& mycell = pop.GetCell(m_organism->GetCellID()); in Inst_RotateToMostNeedy()
5813 neighbor = m_organism->GetNeighbor(); in Inst_RotateToMostNeedy()
5840 if (m_organism->GetCellID() < 0) { in Inst_RequestEnergy()
5844 cOrgMessage msg(m_organism); in Inst_RequestEnergy()
5847 m_organism->BroadcastMessage(ctx, msg, m_world->GetConfig().ENERGY_REQUEST_RADIUS.Get()); in Inst_RequestEnergy()
5848 m_organism->GetPhenotype().SetIsEnergyRequestor(); in Inst_RequestEnergy()
5849 m_organism->GetPhenotype().IncreaseNumEnergyRequests(); in Inst_RequestEnergy()
5859 if (m_organism->GetCellID() < 0) { in Inst_RequestEnergyFlagOn()
5863 m_organism->GetPhenotype().SetIsEnergyRequestor(); in Inst_RequestEnergyFlagOn()
5864 m_organism->GetPhenotype().IncreaseNumEnergyRequests(); in Inst_RequestEnergyFlagOn()
5865 m_organism->GetPhenotype().SetHasOpenEnergyRequest(); in Inst_RequestEnergyFlagOn()
5874 if (m_organism->GetCellID() < 0) { in Inst_RequestEnergyFlagOff()
5878 m_organism->GetPhenotype().ClearHasOpenEnergyRequest(); in Inst_RequestEnergyFlagOff()
5886 double curr_amount = m_organism->GetFracEnergyDonating(); in Inst_IncreaseEnergyDonation()
5889 m_organism->SetFracEnergyDonating(min(1.0, curr_amount + increment)); in Inst_IncreaseEnergyDonation()
5899 double curr_amount = m_organism->GetFracEnergyDonating(); in Inst_DecreaseEnergyDonation()
5902 m_organism->SetFracEnergyDonating(max(0.0, curr_amount - increment)); in Inst_DecreaseEnergyDonation()
5918 const tArray<double> &resources = m_organism->GetOrgInterface().GetResources(ctx); in DoResourceDonatePercent()
5936 const tArray<double> &src_resources = m_organism->GetOrgInterface().GetResources(ctx); in DoResourceDonateAmount()
5957 m_organism->GetOrgInterface().UpdateResources(ctx, src_change); in DoResourceDonateAmount()
5966 assert(m_organism != 0); in DonateResourceX()
5973 current_cell = m_organism->GetCellID(); in DonateResourceX()
6041 m_organism->AddOutput(1); in Inst_IOBufAdd1()
6046 m_organism->AddOutput(0); in Inst_IOBufAdd0()
6052 const int num_neighbors = m_organism->GetNeighborhoodSize(); in Inst_RotateL()
6060 m_organism->Rotate(-1); in Inst_RotateL()
6068 cOrganism* neighbor = m_organism->GetNeighbor(); in Inst_RotateL()
6073 m_organism->Rotate(1); in Inst_RotateL()
6080 const int num_neighbors = m_organism->GetNeighborhoodSize(); in Inst_RotateR()
6088 m_organism->Rotate(1); in Inst_RotateR()
6096 cOrganism* neighbor = m_organism->GetNeighbor(); in Inst_RotateR()
6101 m_organism->Rotate(-1); in Inst_RotateR()
6108 m_organism->Rotate(1); in Inst_RotateLeftOne()
6114 m_organism->Rotate(-1); in Inst_RotateRightOne()
6124 actualNeighborhoodSize = m_organism->GetNeighborhoodSize(); in Inst_RotateLabel()
6136 currentFacing = m_organism->GetFacing(); in Inst_RotateLabel()
6139 m_organism->Rotate(1); in Inst_RotateLabel()
6148 for (int i = 0; i < m_organism->GetNeighborhoodSize(); i++) { in Inst_RotateUnoccupiedCell()
6149 if (!m_organism->IsNeighborCellOccupied()) { // faced cell is unoccupied in Inst_RotateUnoccupiedCell()
6153 m_organism->Rotate(1); // continue to rotate in Inst_RotateUnoccupiedCell()
6163 for (int i = 0; i < m_organism->GetNeighborhoodSize(); i++) { in Inst_RotateOccupiedCell()
6164 if (m_organism->IsNeighborCellOccupied()) { // faced cell is occupied in Inst_RotateOccupiedCell()
6168 m_organism->Rotate(1); // continue to rotate in Inst_RotateOccupiedCell()
6176 m_organism->Rotate(1); in Inst_RotateNextOccupiedCell()
6182 m_organism->Rotate(1); // continue to rotate in Inst_RotateNextUnoccupiedCell()
6190 for (int i = 0; i < m_organism->GetNeighborhoodSize(); i++) { in Inst_RotateEventCell()
6191 if (m_organism->GetCellData() > 0) { // event in faced cell in Inst_RotateEventCell()
6195 m_organism->Rotate(1); // continue to rotate in Inst_RotateEventCell()
6203 int actualNeighborhoodSize = m_organism->GetNeighborhoodSize(); in Inst_RotateUphill()
6206 …if(m_organism->GetOrgInterface().HasOpinion(m_organism)) opinion = m_organism->GetOpinion().first; in Inst_RotateUphill()
6208 const tArray<double> current_res = m_organism->GetOrgInterface().GetResources(ctx); in Inst_RotateUphill()
6211 m_organism->Rotate(1); in Inst_RotateUphill()
6212 tArray<double> faced_res = m_organism->GetOrgInterface().GetFacedCellResources(ctx); in Inst_RotateUphill()
6218 tArray<double> faced_res = m_organism->GetOrgInterface().GetFacedCellResources(ctx); in Inst_RotateUphill()
6219 if (faced_res[opinion] != max_res) m_organism->Rotate(1); in Inst_RotateUphill()
6235 int easterly = m_organism->GetEasterly(); in Inst_RotateHome()
6236 int northerly = m_organism->GetNortherly(); in Inst_RotateHome()
6246 for (int i = 0; i < m_organism->GetNeighborhoodSize(); i++) { in Inst_RotateHome()
6247 m_organism->Rotate(1); in Inst_RotateHome()
6248 if (m_organism->GetFacedDir() == correct_facing) break; in Inst_RotateHome()
6257 m_organism->SetCopyMutProb(static_cast<double>(new_mut_rate) / 10000.0); in Inst_SetCopyMut()
6264 …const double new_mut_rate = m_organism->GetCopyMutProb() + static_cast<double>(GetRegister(reg_use… in Inst_ModCopyMut()
6265 if (new_mut_rate > 0.0) m_organism->SetCopyMutProb(new_mut_rate); in Inst_ModCopyMut()
6275 const int num_neighbors = m_organism->GetNeighborhoodSize(); in Inst_Tumble()
6282 m_organism->Rotate(1); in Inst_Tumble()
6299 const cStateGrid& sg = m_organism->GetStateGrid(); in Inst_SGMove()
6373 const cStateGrid& sg = m_organism->GetStateGrid(); in Inst_SGSense()
6386 if (m_organism->GetCellID() == -1) return false; in Inst_Move()
6388 bool move_success = m_organism->Move(ctx); in Inst_Move()
6398 for (int i = 0; i < m_organism->GetNeighborhoodSize(); i++) { in Inst_MoveToEvent()
6399 if (m_organism->GetNeighborCellContents() > 0) { in Inst_MoveToEvent()
6404 m_organism->Rotate(1); in Inst_MoveToEvent()
6413 for (int i = 0; i < m_organism->GetNeighborhoodSize(); i++) { in Inst_IfNeighborEventInUnoccupiedCell()
6414 if (m_organism->GetNeighborCellContents() > 0 && !m_organism->IsNeighborCellOccupied()) { in Inst_IfNeighborEventInUnoccupiedCell()
6417 m_organism->Rotate(1); in Inst_IfNeighborEventInUnoccupiedCell()
6425 if (m_organism->GetNeighborCellContents() > 0) { in Inst_IfFacingEventCell()
6434 if (m_organism->GetCellData() > 0) { in Inst_IfEventInCell()
6445 if (!ForkThread()) m_organism->Fault(FAULT_LOC_THREAD_FORK, FAULT_TYPE_FORK_TH); in Inst_ForkThread()
6463 if (!ForkThread()) m_organism->Fault(FAULT_LOC_THREAD_FORK, FAULT_TYPE_FORK_TH); in Inst_ForkThreadLabel()
6490 if (!KillThread()) m_organism->Fault(FAULT_LOC_THREAD_KILL, FAULT_TYPE_KILL_TH); in Inst_KillThread()
6540 cDeme &deme = pop.GetDeme(pop.GetCell(m_organism->GetCellID()).GetDemeID()); in Inst_ResMoveHead()
6591 cDeme &deme = pop.GetDeme(pop.GetCell(m_organism->GetCellID()).GetDemeID()); in Inst_ResJumpHead()
6665 GetRegister(REG_BX) = (int) m_organism->GetPhenotype().BornParentGroup(); in Inst_HeadDivideMut()
6731 m_organism->GetPhenotype().SetDivideSex(true); in Inst_HeadDivideSex()
6732 m_organism->GetPhenotype().SetCrossNum(1); in Inst_HeadDivideSex()
6738 m_organism->GetPhenotype().SetDivideSex(false); in Inst_HeadDivideAsex()
6739 m_organism->GetPhenotype().SetCrossNum(0); in Inst_HeadDivideAsex()
6745 m_organism->GetPhenotype().SetDivideSex(true); in Inst_HeadDivideAsexWait()
6746 m_organism->GetPhenotype().SetCrossNum(0); in Inst_HeadDivideAsexWait()
6755 m_organism->GetPhenotype().SetMateSelectID( GetLabel().AsInt(NUM_NOPS) ); in Inst_HeadDivideMateSelect()
6758 m_organism->GetPhenotype().SetDivideSex(true); in Inst_HeadDivideMateSelect()
6759 m_organism->GetPhenotype().SetCrossNum(1); in Inst_HeadDivideMateSelect()
6797 if (m_organism->TestCopyMut(ctx)) { in Inst_HeadRead()
6805 if (m_slip_read_head && m_organism->TestCopySlip(ctx)) { in Inst_HeadRead()
6827 if (m_organism->TestCopyIns(ctx)) active_head.InsertInst(m_inst_set->GetRandomInst(ctx)); in Inst_HeadWrite()
6828 if (m_organism->TestCopyDel(ctx)) active_head.RemoveInst(); in Inst_HeadWrite()
6829 if (m_organism->TestCopyUniform(ctx)) doUniformCopyMutation(ctx, active_head); in Inst_HeadWrite()
6830 if (!m_slip_read_head && m_organism->TestCopySlip(ctx)) { in Inst_HeadWrite()
6854 if (m_organism->TestCopyMut(ctx) && !(checkNoMutList(read_head))) { in Inst_HeadCopy()
6863 if (m_organism->TestCopyIns(ctx)) write_head.InsertInst(m_inst_set->GetRandomInst(ctx)); in Inst_HeadCopy()
6864 if (m_organism->TestCopyDel(ctx)) write_head.RemoveInst(); in Inst_HeadCopy()
6865 if (m_organism->TestCopyUniform(ctx)) doUniformCopyMutation(ctx, write_head); in Inst_HeadCopy()
6866 if (m_organism->TestCopySlip(ctx)) { in Inst_HeadCopy()
6892 …if ( ctx.GetRandom().P(m_organism->GetCopyMutProb() / reduction) && !(checkNoMutList(read_head))) { in HeadCopy_ErrorCorrect()
6901 …if (ctx.GetRandom().P(m_organism->GetCopyInsProb() / reduction)) write_head.InsertInst(m_inst_set-… in HeadCopy_ErrorCorrect()
6902 if (ctx.GetRandom().P(m_organism->GetCopyDelProb() / reduction)) write_head.RemoveInst(); in HeadCopy_ErrorCorrect()
6903 …if (ctx.GetRandom().P(m_organism->GetCopyUniformProb() / reduction)) doUniformCopyMutation(ctx, wr… in HeadCopy_ErrorCorrect()
6904 if (ctx.GetRandom().P(m_organism->GetCopySlipProb() / reduction)) { in HeadCopy_ErrorCorrect()
6963 if (m_organism->GetCellID() < 0) { in Inst_IfEnergyLow()
6968 if (m_organism->GetPhenotype().GetDiscreteEnergyLevel() != cPhenotype::ENERGY_LEVEL_LOW) { in Inst_IfEnergyLow()
6980 if (m_organism->GetCellID() < 0) { in Inst_IfEnergyNotLow()
6984 if (m_organism->GetPhenotype().GetDiscreteEnergyLevel() == cPhenotype::ENERGY_LEVEL_LOW) { in Inst_IfEnergyNotLow()
6996 if (m_organism->GetCellID() < 0) { in Inst_IfFacedEnergyLow()
7001 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_IfFacedEnergyLow()
7018 if (m_organism->GetCellID() < 0) { in Inst_IfFacedEnergyNotLow()
7023 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_IfFacedEnergyNotLow()
7040 if (m_organism->GetCellID() < 0) { in Inst_IfEnergyHigh()
7044 if (m_organism->GetPhenotype().GetDiscreteEnergyLevel() != cPhenotype::ENERGY_LEVEL_HIGH) { in Inst_IfEnergyHigh()
7056 if (m_organism->GetCellID() < 0) { in Inst_IfEnergyNotHigh()
7060 if (m_organism->GetPhenotype().GetDiscreteEnergyLevel() == cPhenotype::ENERGY_LEVEL_HIGH) { in Inst_IfEnergyNotHigh()
7072 if (m_organism->GetCellID() < 0) { in Inst_IfFacedEnergyHigh()
7077 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_IfFacedEnergyHigh()
7094 if (m_organism->GetCellID() < 0) { in Inst_IfFacedEnergyNotHigh()
7099 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_IfFacedEnergyNotHigh()
7116 if (m_organism->GetCellID() < 0) { in Inst_IfEnergyMed()
7120 if (m_organism->GetPhenotype().GetDiscreteEnergyLevel() != cPhenotype::ENERGY_LEVEL_MEDIUM) { in Inst_IfEnergyMed()
7132 if (m_organism->GetCellID() < 0) { in Inst_IfFacedEnergyMed()
7137 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_IfFacedEnergyMed()
7154 if (m_organism->GetCellID() < 0) { in Inst_IfFacedEnergyLess()
7159 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_IfFacedEnergyLess()
7163 const double my_energy = m_organism->GetPhenotype().GetStoredEnergy(); in Inst_IfFacedEnergyLess()
7179 if (m_organism->GetCellID() < 0) { in Inst_IfFacedEnergyMore()
7184 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_IfFacedEnergyMore()
7188 const double my_energy = m_organism->GetPhenotype().GetStoredEnergy(); in Inst_IfFacedEnergyMore()
7204 if (m_organism->GetCellID() < 0) { in Inst_IfEnergyInBuffer()
7208 if (m_organism->GetPhenotype().GetEnergyInBufferAmount() == 0) { in Inst_IfEnergyInBuffer()
7220 if (m_organism->GetCellID() < 0) { in Inst_IfEnergyNotInBuffer()
7224 if (m_organism->GetPhenotype().GetEnergyInBufferAmount() > 0) { in Inst_IfEnergyNotInBuffer()
7235 if (m_organism->GetCellID() < 0) { in Inst_GetEnergyLevel()
7240 GetRegister(reg) = (int) floor(m_organism->GetPhenotype().GetStoredEnergy()); in Inst_GetEnergyLevel()
7249 if (m_organism->GetCellID() < 0) { in Inst_GetFacedEnergyLevel()
7253 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_GetFacedEnergyLevel()
7269 if (m_organism->GetCellID() < 0) { in Inst_IfFacedEnergyRequestOn()
7273 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_IfFacedEnergyRequestOn()
7289 if (m_organism->GetCellID() < 0) { in Inst_IfFacedEnergyRequestOff()
7293 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_IfFacedEnergyRequestOff()
7310 if (m_organism->GetCellID() < 0) { in Inst_GetEnergyRequestStatus()
7317 if (m_organism->GetPhenotype().IsEnergyRequestor() == true) { in Inst_GetEnergyRequestStatus()
7330 if (m_organism->GetCellID() < 0) return false; in Inst_GetFacedEnergyRequestStatus()
7332 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_GetFacedEnergyRequestStatus()
7354 m_organism->SetSleeping(false); //this instruction get executed at the end of a sleep cycle in Inst_Sleep()
7356 cPhenotype& phenotype = m_organism->GetPhenotype(); in Inst_Sleep()
7361 m_organism->UpdateMerit(newMerit); in Inst_Sleep()
7383 int x = m_organism->GetOrgInterface().GetCellXPosition(); in Inst_GetCellPosition()
7384 int y = m_organism->GetOrgInterface().GetCellYPosition(); in Inst_GetCellPosition()
7403 int x = m_organism->GetOrgInterface().GetCellXPosition(); in Inst_GetCellPositionX()
7420 int y = m_organism->GetOrgInterface().GetCellYPosition(); in Inst_GetCellPositionY()
7432 int absolute_cell_ID = m_organism->GetOrgInterface().GetCellID(); in Inst_GetDistanceFromDiagonal()
7433 int deme_id = m_organism->GetOrgInterface().GetDemeID(); in Inst_GetDistanceFromDiagonal()
7452 GetRegister(out_reg) = m_organism->GetFacedDir(); in Inst_GetDirectionOffNorth()
7458 GetRegister(out_reg) = m_organism->GetNortherly(); in Inst_GetNortherly()
7464 GetRegister(out_reg) = m_organism->GetEasterly(); in Inst_GetEasterly()
7469 m_organism->ClearEasterly(); in Inst_ZeroEasterly()
7474 m_organism->ClearNortherly(); in Inst_ZeroNortherly()
7500 m_organism->GetOrgInterface().ResetInputs(ctx); // Re-randomize the inputs this organism sees in Inst_Terminate()
7501m_organism->ClearInput(); // Also clear their input buffers, or they can s… in Inst_Terminate()
7545 m_organism->Die(ctx); in Inst_Terminate()
7609 const tArray<double> & res_count = m_organism->GetOrgInterface().GetResources(ctx); in Inst_SenseRegulate()
7943 m_organism->Fault(FAULT_LOC_THREAD_KILL, FAULT_TYPE_KILL_TH); in Inst_End_Handler()
7956 cOrgMessage msg = cOrgMessage(m_organism, messageType); in SendMessage()
7960 return m_organism->SendMessage(ctx, msg); in SendMessage()
7971 std::pair<bool, cOrgMessage> retrieved = m_organism->RetrieveMessage(); in Inst_RetrieveMessage()
7987 …return m_organism->BcastAlarmMSG(ctx, abs(GetRegister(reg_used)%2), m_world->GetConfig().BCAST_HOP… in Inst_Alarm_MSG_multihop()
7993 …return m_organism->BcastAlarmMSG(ctx, (BitCount(GetRegister(reg_used) & MASK24) >= CONSENSUS24) ? … in Inst_Alarm_MSG_Bit_Cons24_multihop()
7999 …return m_organism->BcastAlarmMSG(ctx, abs(GetRegister(reg_used)%2), 1); // jump to Alarm-label- o… in Inst_Alarm_MSG_local()
8005 …return m_organism->BcastAlarmMSG(ctx, (BitCount(GetRegister(reg_used) & MASK24) >= CONSENSUS24) ? … in Inst_Alarm_MSG_Bit_Cons24_local()
8016 if (m_organism->IsSleeping()) { in Jump_To_Alarm_Label()
8060 m_organism->SetPheromone(true); in Inst_PheroOn()
8066 m_organism->SetPheromone(false); in Inst_PheroOff()
8072 m_organism->TogglePheromone(); in Inst_PheroToggle()
8079 cPopulationCell& mycell = m_world->GetPopulation().GetCell(m_organism->GetCellID()); in DoSenseFacing()
8179 m_organism->GetPhenotype().IncSenseCount(sensed_index); in DoSenseFacing()
8205 int cellid = m_organism->GetCellID(); in Inst_SenseTarget()
8230 int cellid = m_organism->GetCellID(); in Inst_SenseTargetFaced()
8289 if (m_organism->GetCellID() == -1) { in DoSensePheromoneInDemeGlobal()
8293 cDeme& deme = m_world->GetPopulation().GetDeme(m_organism->GetDemeID()); in DoSensePheromoneInDemeGlobal()
8314 const tArray<double>& resource_count_array = m_organism->GetOrgInterface().GetResources(ctx); in DoSensePheromoneGlobal()
8334 int cellid = m_organism->GetCellID(); //absolute id of current cell in Inst_SensePheromone()
8346 int cellid = m_organism->GetCellID(); //absolute id of current cell in Inst_SensePheromoneFaced()
8383 int cellid = m_organism->GetCellID(); in Inst_Exploit()
8394 num_rotations = ctx.GetRandom().GetUInt(m_organism->GetNeighborhoodSize()); in Inst_Exploit()
8421 m_organism->Move(ctx); in Inst_Exploit()
8439 int cellid = m_organism->GetCellID(); in Inst_ExploitForward5()
8452 num_rotations = ctx.GetRandom().GetUInt(m_organism->GetNeighborhoodSize()); in Inst_ExploitForward5()
8487 m_organism->Move(ctx); in Inst_ExploitForward5()
8504 int cellid = m_organism->GetCellID(); in Inst_ExploitForward3()
8517 num_rotations = ctx.GetRandom().GetUInt(m_organism->GetNeighborhoodSize()); in Inst_ExploitForward3()
8552 m_organism->Move(ctx); in Inst_ExploitForward3()
8560 int cellid = m_organism->GetCellID(); in Inst_Explore()
8567 const int num_neighbors = m_organism->GetNeighborhoodSize(); in Inst_Explore()
8569 m_organism->Rotate(1); // Rotate doesn't rotate N times, just once. in Inst_Explore()
8572 m_organism->Move(ctx); in Inst_Explore()
8587 int cellid = m_organism->GetCellID(); in Inst_MoveTarget()
8616 m_organism->Move(ctx); in Inst_MoveTarget()
8633 int cellid = m_organism->GetCellID(); in Inst_MoveTargetForward5()
8669 m_organism->Move(ctx); in Inst_MoveTargetForward5()
8685 int cellid = m_organism->GetCellID(); in Inst_MoveTargetForward3()
8721 m_organism->Move(ctx); in Inst_MoveTargetForward3()
8734 int cellid = m_organism->GetCellID(); in Inst_SuperMove()
8749 const int num_neighbors = m_organism->GetNeighborhoodSize(); in Inst_SuperMove()
8790 m_organism->Move(ctx); in Inst_SuperMove()
8798 int cellid = m_organism->GetCellID(); //absolute id of current cell in Inst_IfTarget()
8816 int cellid = m_organism->GetCellID(); //absolute id of current cell in Inst_IfNotTarget()
8834 int cellid = m_organism->GetCellID(); //absolute id of current cell in Inst_IfPheromone()
8868 int cellid = m_organism->GetCellID(); //absolute id of current cell in Inst_IfNotPheromone()
8903 int cellid = m_organism->GetCellID(); in Inst_DropPheromone()
8946 (m_organism->GetPheromoneStatus() == true) ) { in Inst_DropPheromone()
8952 …ngUtil::Stringf("%d,%d,%d,%d,%f,%d", m_world->GetStats().GetUpdate(), m_organism->GetID(), deme.G… in Inst_DropPheromone()
8967 assert(m_organism != 0); in Inst_SetOpinion()
8968 m_organism->GetOrgInterface().SetOpinion(GetRegister(FindModifiedRegister(REG_BX)), m_organism); in Inst_SetOpinion()
8979 assert(m_organism != 0); in Inst_GetOpinion()
8980 if (m_organism->GetOrgInterface().HasOpinion(m_organism)) { in Inst_GetOpinion()
8984 GetRegister(opinion_reg) = m_organism->GetOpinion().first; in Inst_GetOpinion()
8985 GetRegister(age_reg) = m_world->GetStats().GetUpdate() - m_organism->GetOpinion().second; in Inst_GetOpinion()
8992 assert(m_organism != 0); in Inst_GetOpinionOnly_ZeroIfNone()
8994 if (m_organism->GetOrgInterface().HasOpinion(m_organism)) { in Inst_GetOpinionOnly_ZeroIfNone()
8995 GetRegister(opinion_reg) = m_organism->GetOpinion().first; in Inst_GetOpinionOnly_ZeroIfNone()
9006 assert(m_organism != 0); in Inst_ClearOpinion()
9007 m_organism->GetOrgInterface().ClearOpinion(m_organism); in Inst_ClearOpinion()
9016 assert(m_organism != 0); in Inst_IfOpinionSet()
9017 if (!m_organism->GetOrgInterface().HasOpinion(m_organism)) getIP().Advance(); in Inst_IfOpinionSet()
9024 assert(m_organism != 0); in Inst_IfOpinionNotSet()
9025 if (m_organism->GetOrgInterface().HasOpinion(m_organism)) getIP().Advance(); in Inst_IfOpinionNotSet()
9033 assert(m_organism != 0); in Inst_SetOpinionToZero()
9036 m_organism->GetOrgInterface().SetOpinion(GetRegister(FindModifiedRegister(REG_BX)), m_organism); in Inst_SetOpinionToZero()
9037 m_organism->DoOutput(ctx, 0); in Inst_SetOpinionToZero()
9044 assert(m_organism != 0); in Inst_SetOpinionToOne()
9047 m_organism->GetOrgInterface().SetOpinion(GetRegister(FindModifiedRegister(REG_BX)), m_organism); in Inst_SetOpinionToOne()
9048 m_organism->DoOutput(ctx, 1); in Inst_SetOpinionToOne()
9055 assert(m_organism != 0); in Inst_SetOpinionToTwo()
9058 m_organism->GetOrgInterface().SetOpinion(GetRegister(FindModifiedRegister(REG_BX)), m_organism); in Inst_SetOpinionToTwo()
9059 m_organism->DoOutput(ctx, 2); in Inst_SetOpinionToTwo()
9072 assert(m_organism != 0); in Inst_CollectCellData()
9074 GetRegister(out_reg) = m_organism->GetCellData(); in Inst_CollectCellData()
9089 assert(m_organism != 0); in Inst_IfCellDataChanged()
9092 if (!m_last_cell_data.first || (m_last_cell_data.second == m_organism->GetCellData())) { in Inst_IfCellDataChanged()
9103 if ((m_organism->GetOrgInterface().GetDemeID() < 0) || (m_organism->GetCellID() < 0)) { in Inst_KillCellEvent()
9108 int eventID = m_organism->GetCellData(); in Inst_KillCellEvent()
9109 GetRegister(reg) = m_organism->GetOrgInterface().GetDeme()->KillCellEvent(eventID); in Inst_KillCellEvent()
9118 if ((m_organism->GetOrgInterface().GetDemeID() < 0) || (m_organism->GetCellID() < 0)) { in Inst_KillFacedCellEvent()
9123 int eventID = m_organism->GetNeighborCellContents(); in Inst_KillFacedCellEvent()
9124 GetRegister(reg) = m_organism->GetOrgInterface().GetDeme()->KillCellEvent(eventID); in Inst_KillFacedCellEvent()
9127 m_organism->SetEventKilled(); in Inst_KillFacedCellEvent()
9137 if ((m_organism->GetOrgInterface().GetDemeID() < 0) || (m_organism->GetCellID() < 0)) { in Inst_CollectCellDataAndKillEvent()
9142 int eventID = m_organism->GetCellData(); in Inst_CollectCellDataAndKillEvent()
9145 m_organism->GetOrgInterface().GetDeme()->KillCellEvent(eventID); in Inst_CollectCellDataAndKillEvent()
9153 assert(m_organism != 0); in Inst_ReadCellData()
9155 GetRegister(out_reg) = m_organism->GetCellData(); in Inst_ReadCellData()
9162 assert(m_organism != 0); in Inst_ReadFacedCellData()
9165 int my_vit = (int) (m_organism->GetVitality() + 0.5); in Inst_ReadFacedCellData()
9166 int vit_diff = (m_organism->GetFacedCellData() - my_vit)/my_vit * 100; in Inst_ReadFacedCellData()
9174 assert(m_organism != 0); in Inst_ReadFacedCellDataOrgID()
9176 GetRegister(out_reg) = m_organism->GetFacedCellDataOrgID(); in Inst_ReadFacedCellDataOrgID()
9183 assert(m_organism != 0); in Inst_ReadFacedCellDataFreshness()
9185 GetRegister(out_reg) = m_world->GetStats().GetUpdate() - m_organism->GetFacedCellDataUpdate(); in Inst_ReadFacedCellDataFreshness()
9192 assert(m_organism != 0); in Inst_MarkCellWithID()
9193 m_organism->SetCellData(m_organism->GetID()); in Inst_MarkCellWithID()
9201 assert(m_organism != 0); in Inst_GetResStored()
9205 int res_stored = (int) (m_organism->GetRBin(resource) * 100 - 0.5); in Inst_GetResStored()
9212 assert(m_organism != 0); in Inst_MarkCellWithVitality()
9214 int my_vit = (int) (m_organism->GetVitality() + 0.5); in Inst_MarkCellWithVitality()
9215 m_organism->SetCellData(my_vit); in Inst_MarkCellWithVitality()
9222 assert(m_organism != 0); in Inst_GetID()
9224 GetRegister(out_reg) = m_organism->GetID(); in Inst_GetID()
9232 assert(m_organism != 0); in Inst_GetFacedVitalityDiff()
9234 if (!m_organism->IsNeighborCellOccupied()) return false; in Inst_GetFacedVitalityDiff()
9236 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_GetFacedVitalityDiff()
9241 …int vit_diff = (int) ((neighbor->GetVitality() - m_organism->GetVitality())/m_organism->GetVitali… in Inst_GetFacedVitalityDiff()
9250 if (!m_organism->IsNeighborCellOccupied()) return false; in Inst_GetFacedOrgID()
9252 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_GetFacedOrgID()
9264 assert(m_organism != 0); in Inst_AttackFacedOrg()
9265 if (!m_organism->IsNeighborCellOccupied()) return false; in Inst_AttackFacedOrg()
9267 cOrganism* target = m_organism->GetNeighbor(); in Inst_AttackFacedOrg()
9279 const double attacker_vitality = m_organism->GetVitality(); in Inst_AttackFacedOrg()
9292 m_organism->Die(ctx); in Inst_AttackFacedOrg()
9303 assert(m_organism != 0); in Inst_GetAttackOdds()
9304 if (!m_organism->IsNeighborCellOccupied()) return false; in Inst_GetAttackOdds()
9306 cOrganism* target = m_organism->GetNeighbor(); in Inst_GetAttackOdds()
9309 const double attacker_vitality = m_organism->GetVitality(); in Inst_GetAttackOdds()
9336 assert(m_organism != 0); in Inst_Flash()
9337 m_organism->SendFlash(ctx); in Inst_Flash()
9345 assert(m_organism != 0); in Inst_IfRecvdFlash()
9357 assert(m_organism != 0); in Inst_FlashInfo()
9376 assert(m_organism != 0); in Inst_FlashInfoB()
9392 assert(m_organism != 0); in Inst_ResetFlashInfo()
9420 assert(m_organism != 0); in Inst_GetNeighborhood()
9421 m_organism->LoadNeighborhood(); in Inst_GetNeighborhood()
9430 assert(m_organism != 0); in Inst_IfNeighborhoodChanged()
9431 if (!m_organism->HasNeighborhoodChanged()) { in Inst_IfNeighborhoodChanged()
9545 cOrgMessage msg = cOrgMessage(m_organism); in BroadcastX()
9548 return m_organism->BroadcastMessage(ctx, msg, depth); in BroadcastX()
9588 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_DonateIfDonor()
9591 if (m_organism->IsDonor(neighbor->GetID())) { in Inst_DonateIfDonor()
9605 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_DonateFacingRawMaterialsOtherSpecies()
9608 int spec_self = m_organism->GetLineageLabel(); in Inst_DonateFacingRawMaterialsOtherSpecies()
9622 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_DonateFacingString()
9624 int my_string = m_organism->GetLineageLabel(); in Inst_DonateFacingString()
9630 …if ((m_organism->GetNumberStringsOnHand(my_string) >= cost) && (neighbor->CanReceiveString(my_stri… in Inst_DonateFacingString()
9642 m_organism->DonateString(my_string, cost); in Inst_DonateFacingString()
9643 neighbor->AddOtherRawMaterials(cost, m_organism->GetID()); in Inst_DonateFacingString()
9644 neighbor->ReceiveString(my_string, cost, m_organism->GetID()); in Inst_DonateFacingString()
9645 neighbor->AddDonatedLineage(m_organism->GetLineageLabel()); in Inst_DonateFacingString()
9648 m_organism->Donated(); in Inst_DonateFacingString()
9661 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_DonateFacingRawMaterials()
9669 if (m_organism->SubtractSelfRawMaterials(cost)) { in Inst_DonateFacingRawMaterials()
9681 neighbor->AddOtherRawMaterials(cost, m_organism->GetID()); in Inst_DonateFacingRawMaterials()
9682 neighbor->AddDonatedLineage(m_organism->GetLineageLabel()); in Inst_DonateFacingRawMaterials()
9688 while (neighbor->GetNeighbor() != m_organism) { in Inst_DonateFacingRawMaterials()
9694 m_organism->Donated(); in Inst_DonateFacingRawMaterials()
9710 m_organism->SetReputation(m_organism->GetReputation() + 1); in Inst_Pose()
9726 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_GetNeighborsReputation()
9744 GetRegister(opinion_reg) = m_organism->GetReputation(); in Inst_GetReputation()
9753 GetRegister(raw_mat_reg) = m_organism->GetNumberStringsOnHand(0); in Inst_GetAmountOfRawMaterials()
9762 GetRegister(raw_mat_reg) = m_organism->GetNumberStringsOnHand(1); in Inst_GetAmountOfOtherRawMaterials()
9771 m_organism->GetOrgInterface().RotateToGreatestReputation(); in Inst_RotateToGreatestReputation()
9780m_organism->GetOrgInterface().RotateToGreatestReputationWithDifferentTag(m_organism->GetTagLabel()… in Inst_RotateToGreatestReputationWithDifferentTag()
9788m_organism->GetOrgInterface().RotateToGreatestReputationWithDifferentLineage(m_organism->GetLineag… in Inst_RotateToGreatestReputationWithDifferentLineage()
9808 const int num_neighbors = m_organism->GetNeighborhoodSize(); in Inst_RotateToDifferentTag()
9812 for (int i = 0; i < neighbor_id; i++) m_organism->Rotate(1); in Inst_RotateToDifferentTag()
9813 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_RotateToDifferentTag()
9822 neighbor = m_organism->GetNeighbor(); in Inst_RotateToDifferentTag()
9826 if (m_organism->GetTagLabel() != neighbor->GetTagLabel()) found = true; in Inst_RotateToDifferentTag()
9834 m_organism->Rotate(1); in Inst_RotateToDifferentTag()
9847 cOrganism * neighbor = m_organism->GetNeighbor(); in Inst_IfDonor()
9850 if (m_organism->IsDonor(neighbor->GetID())) { in Inst_IfDonor()
9862 cOrganism * neighbor = m_organism->GetNeighbor(); in ComputeReputation()
9868 int my_rep = m_organism->GetReputation(); in ComputeReputation()
9869 m_organism->SetReputation(my_rep +1); in ComputeReputation()
9876 int my_rep = m_organism->GetReputation(); in ComputeReputation()
9877 m_organism->SetReputation(my_rep +1); in ComputeReputation()
9883 m_organism->SetReputation(1); in ComputeReputation()
9890 int my_rep = m_organism->GetReputation(); in ComputeReputation()
9891 m_organism->SetReputation(my_rep +1); in ComputeReputation()
9909 m_organism->InitStringMap(); in Inst_ProduceString()
9915 num = m_organism->MatchOutputBuffer(temp_strings[i]); in Inst_ProduceString()
9924 if (m_organism->GetLineageLabel() != max_string) { in Inst_ProduceString()
9932 val = m_organism->ProduceString(max_string); in Inst_ProduceString()
9935 m_organism->AddSelfRawMaterials(1); in Inst_ProduceString()
9938 if (val) m_organism->SetOutputNegative1(); in Inst_ProduceString()
9949 assert(m_organism != 0); in Inst_JoinGroup()
9958 if (m_organism->GetOrgInterface().HasOpinion(m_organism)) { in Inst_JoinGroup()
9959 opinion = m_organism->GetOpinion().first; in Inst_JoinGroup()
9971 m_organism->Die(ctx); in Inst_JoinGroup()
9978 m_organism->GetOrgInterface().AttemptImmigrateGroup(prop_group_id, m_organism); in Inst_JoinGroup()
9983 m_organism->LeaveGroup(opinion); in Inst_JoinGroup()
9988 m_organism->GetOrgInterface().SetOpinion(prop_group_id, m_organism); in Inst_JoinGroup()
9991 if (m_organism->GetOrgInterface().HasOpinion(m_organism)) { in Inst_JoinGroup()
9992 opinion = m_organism->GetOpinion().first; in Inst_JoinGroup()
9993 m_organism->JoinGroup(opinion); in Inst_JoinGroup()
10000 if (m_organism->GetPhenotype().GetMatingType() == MATING_TYPE_JUVENILE) return false; in Inst_JoinMTGroup()
10012 if (!m_organism->GetOrgInterface().HasOpinion(m_organism)) return false; in Inst_JoinNextGroup()
10039 m_organism->Die(ctx); in Inst_JoinNextGroup()
10044 int opinion = m_organism->GetOpinion().first; in Inst_JoinNextGroup()
10073 m_organism->GetOrgInterface().AttemptImmigrateGroup(new_opinion, m_organism); in Inst_JoinNextGroup()
10076 m_organism->GetOrgInterface().SetOpinion(new_opinion, m_organism); in Inst_JoinNextGroup()
10077 m_organism->LeaveGroup(opinion); in Inst_JoinNextGroup()
10078 m_organism->JoinGroup(new_opinion); in Inst_JoinNextGroup()
10085 if (m_organism->GetPhenotype().GetMatingType() == MATING_TYPE_JUVENILE) return false; in Inst_JoinNextMTGroup()
10093 assert(m_organism != 0); in Inst_NumberOrgsInMyGroup()
10096 if (m_organism->GetOrgInterface().HasOpinion(m_organism)) { in Inst_NumberOrgsInMyGroup()
10097 int opinion = m_organism->GetOpinion().first; in Inst_NumberOrgsInMyGroup()
10098 num_orgs = m_organism->GetOrgInterface().NumberOfOrganismsInGroup(opinion); in Inst_NumberOrgsInMyGroup()
10107 assert(m_organism != 0); in Inst_NumberMTInMyGroup()
10108 if (m_organism->GetPhenotype().GetMatingType() == MATING_TYPE_JUVENILE) return false; in Inst_NumberMTInMyGroup()
10113 if (m_organism->GetOrgInterface().HasOpinion(m_organism)) { in Inst_NumberMTInMyGroup()
10114 int opinion = m_organism->GetOpinion().first; in Inst_NumberMTInMyGroup()
10115 num_fem = m_organism->GetOrgInterface().NumberGroupFemales(opinion); in Inst_NumberMTInMyGroup()
10116 num_male = m_organism->GetOrgInterface().NumberGroupMales(opinion); in Inst_NumberMTInMyGroup()
10117 num_juv = m_organism->GetOrgInterface().NumberGroupJuvs(opinion); in Inst_NumberMTInMyGroup()
10132 assert(m_organism != 0); in Inst_NumberOrgsInGroup()
10136 int num_orgs = m_organism->GetOrgInterface().NumberOfOrganismsInGroup(group_id); in Inst_NumberOrgsInGroup()
10143 assert(m_organism != 0); in Inst_NumberMTInGroup()
10144 if (m_organism->GetPhenotype().GetMatingType() == MATING_TYPE_JUVENILE) return false; in Inst_NumberMTInGroup()
10148 int num_fem = m_organism->GetOrgInterface().NumberGroupFemales(group_id); in Inst_NumberMTInGroup()
10149 int num_male = m_organism->GetOrgInterface().NumberGroupMales(group_id); in Inst_NumberMTInGroup()
10150 int num_juv = m_organism->GetOrgInterface().NumberGroupJuvs(group_id); in Inst_NumberMTInGroup()
10169 if (!m_organism->GetOrgInterface().HasOpinion(m_organism)) return false; in Inst_NumberNextGroup()
10172 int opinion = m_organism->GetOpinion().first; in Inst_NumberNextGroup()
10174 const int num_groups = m_organism->GetOrgInterface().GetResources(ctx).GetSize(); in Inst_NumberNextGroup()
10200 GetRegister(REG_BX) = m_organism->GetOrgInterface().NumberOfOrganismsInGroup(query_group); in Inst_NumberNextGroup()
10207 if (m_organism->GetPhenotype().GetMatingType() == MATING_TYPE_JUVENILE) return false; in Inst_NumberMTNextGroup()
10210 if (!m_organism->GetOrgInterface().HasOpinion(m_organism)) return false; in Inst_NumberMTNextGroup()
10213 int opinion = m_organism->GetOpinion().first; in Inst_NumberMTNextGroup()
10215 const int num_groups = m_organism->GetOrgInterface().GetResources(ctx).GetSize(); in Inst_NumberMTNextGroup()
10241 int num_fem = m_organism->GetOrgInterface().NumberGroupFemales(query_group); in Inst_NumberMTNextGroup()
10242 int num_male = m_organism->GetOrgInterface().NumberGroupMales(query_group); in Inst_NumberMTNextGroup()
10243 int num_juv = m_organism->GetOrgInterface().NumberGroupJuvs(query_group); in Inst_NumberMTNextGroup()
10259 assert(m_organism != 0); in Inst_KillGroupMember()
10261 if (m_organism->GetOrgInterface().HasOpinion(m_organism)) { in Inst_KillGroupMember()
10262 opinion = m_organism->GetOpinion().first; in Inst_KillGroupMember()
10264 m_world->GetPopulation().KillGroupMember(ctx, opinion, m_organism); in Inst_KillGroupMember()
10282 if (!m_organism->GetOrgInterface().HasOpinion(m_organism)) return false; in Inst_IncTolerance()
10300 int result = m_organism->GetOrgInterface().IncTolerance(toleranceType, ctx); in Inst_IncTolerance()
10319 if (!m_organism->GetOrgInterface().HasOpinion(m_organism)) return false; in Inst_DecTolerance()
10337 GetRegister(REG_BX) = m_organism->GetOrgInterface().DecTolerance(toleranceType, ctx); in Inst_DecTolerance()
10350 if(m_organism->GetOrgInterface().HasOpinion(m_organism)) { in Inst_GetTolerance()
10351 m_organism->GetOrgInterface().PushToleranceInstExe(6, ctx); in Inst_GetTolerance()
10353 int tolerance_immigrants = m_organism->GetPhenotype().CalcToleranceImmigrants(); in Inst_GetTolerance()
10354 int tolerance_own = m_organism->GetPhenotype().CalcToleranceOffspringOwn(); in Inst_GetTolerance()
10355 int tolerance_others = m_organism->GetPhenotype().CalcToleranceOffspringOthers(); in Inst_GetTolerance()
10375 if (m_organism->GetOrgInterface().HasOpinion(m_organism)) { in Inst_GetGroupTolerance()
10376 m_organism->GetOrgInterface().PushToleranceInstExe(7, ctx); in Inst_GetGroupTolerance()
10378 const int group_id = m_organism->GetOpinion().first; in Inst_GetGroupTolerance()
10382 if (m_organism->GetPhenotype().GetMatingType() == MATING_TYPE_FEMALE) mating_type = 0; in Inst_GetGroupTolerance()
10383 else if (m_organism->GetPhenotype().GetMatingType() == MATING_TYPE_MALE) mating_type = 1; in Inst_GetGroupTolerance()
10386 …double immigrant_odds = m_organism->GetOrgInterface().CalcGroupOddsImmigrants(group_id, mating_typ… in Inst_GetGroupTolerance()
10387 double offspring_own_odds = m_organism->GetOrgInterface().CalcGroupOddsOffspring(m_organism); in Inst_GetGroupTolerance()
10388 double offspring_others_odds = m_organism->GetOrgInterface().CalcGroupOddsOffspring(group_id); in Inst_GetGroupTolerance()
10410 m_organism->GetOrgInterface().CreateLinkByFacing(GetRegister(wreg)); in Inst_CreateLinkByFacing()
10421m_organism->GetOrgInterface().CreateLinkByXY(GetRegister(xreg), GetRegister(yreg), GetRegister(wre… in Inst_CreateLinkByXY()
10432 m_organism->GetOrgInterface().CreateLinkByIndex(GetRegister(idxreg), GetRegister(wreg)); in Inst_CreateLinkByIndex()
10448 cOrgMessage msg = cOrgMessage(m_organism); in Inst_NetworkBroadcast1()
10451 return m_organism->GetOrgInterface().NetworkBroadcast(msg); in Inst_NetworkBroadcast1()
10461 cOrgMessage msg = cOrgMessage(m_organism); in Inst_NetworkUnicast()
10464 return m_organism->GetOrgInterface().NetworkUnicast(msg); in Inst_NetworkUnicast()
10472 return m_organism->GetOrgInterface().NetworkRotate(GetRegister(reg)); in Inst_NetworkRotate()
10480 return m_organism->GetOrgInterface().NetworkSelect(GetRegister(reg)); in Inst_NetworkSelect()
10486 GetRegister(FindModifiedRegister(REG_BX)) = m_organism->GetPhenotype().GetTimeUsed(); in Inst_GetTimeUsed()
10492 m_organism->DonateResConsumedToDeme(); in Inst_DonateResToDeme()
10507 int num_mut = m_organism->GetHardware().PointMutate(ctx, point_mut_prob); in Inst_ApplyPointMutations()
10508 m_organism->IncPointMutations(num_mut); in Inst_ApplyPointMutations()
10519 int last_task = m_organism->GetPhenotype().GetLastTaskID(); in Inst_ApplyVaryingPointMutations()
10524 int num_mut = m_organism->GetHardware().PointMutate(ctx, point_mut_prob); in Inst_ApplyVaryingPointMutations()
10525 m_organism->IncPointMutations(num_mut); in Inst_ApplyVaryingPointMutations()
10535 if (m_organism->GetOrgInterface().GetDeme() == NULL) return false; in Inst_ApplyPointMutationsGroupRandom()
10540 int deme_size = m_organism->GetDeme()->GetSize(); in Inst_ApplyPointMutationsGroupRandom()
10545 cPopulationCell& cell = m_organism->GetDeme()->GetCell(pos); in Inst_ApplyPointMutationsGroupRandom()
10561 if (m_organism->GetOrgInterface().GetDeme() == NULL) return false; in Inst_ApplyPointMutationsGroupGS()
10565 int deme_size = m_organism->GetDeme()->GetSize(); in Inst_ApplyPointMutationsGroupGS()
10567 bool gs = m_organism->IsGermline(); in Inst_ApplyPointMutationsGroupGS()
10571 cPopulationCell& cell = m_organism->GetDeme()->GetCell(pos); in Inst_ApplyPointMutationsGroupGS()
10586 m_organism->JoinGermline(); in Inst_JoinGermline()
10591 m_organism->ExitGermline(); in Inst_ExitGermline()
10596 m_organism->RepairPointMutOn(); in Inst_RepairPointMutOn()
10601 m_organism->RepairPointMutOff(); in Inst_RepairPointMutOff()
10612 if (m_organism->GetPhenotype().GetMatingType() == MATING_TYPE_FEMALE) { in Inst_SetMatingTypeMale()
10617 if (m_organism->GetOrgInterface().HasOpinion(m_organism)) { in Inst_SetMatingTypeMale()
10620 if (m_organism->GetPhenotype().GetMatingType() == MATING_TYPE_JUVENILE) old_type = 2; in Inst_SetMatingTypeMale()
10621m_organism->GetOrgInterface().ChangeGroupMatingTypes(m_organism, m_organism->GetOpinion().first, o… in Inst_SetMatingTypeMale()
10623 m_organism->GetPhenotype().SetMatingType(MATING_TYPE_MALE); in Inst_SetMatingTypeMale()
10631 if (m_organism->GetPhenotype().GetMatingType() == MATING_TYPE_MALE) { in Inst_SetMatingTypeFemale()
10636 if (m_organism->GetOrgInterface().HasOpinion(m_organism)) { in Inst_SetMatingTypeFemale()
10639 if (m_organism->GetPhenotype().GetMatingType() == MATING_TYPE_JUVENILE) old_type = 2; in Inst_SetMatingTypeFemale()
10640m_organism->GetOrgInterface().ChangeGroupMatingTypes(m_organism, m_organism->GetOpinion().first, o… in Inst_SetMatingTypeFemale()
10642 m_organism->GetPhenotype().SetMatingType(MATING_TYPE_FEMALE); in Inst_SetMatingTypeFemale()
10652 if (m_organism->GetOrgInterface().HasOpinion(m_organism)) { in Inst_SetMatingTypeJuvenile()
10654 if (m_organism->GetPhenotype().GetMatingType() == MATING_TYPE_MALE) old_type = 1; in Inst_SetMatingTypeJuvenile()
10655 else if (m_organism->GetPhenotype().GetMatingType() == MATING_TYPE_JUVENILE) old_type = 2; in Inst_SetMatingTypeJuvenile()
10656m_organism->GetOrgInterface().ChangeGroupMatingTypes(m_organism, m_organism->GetOpinion().first, o… in Inst_SetMatingTypeJuvenile()
10658 m_organism->GetPhenotype().SetMatingType(MATING_TYPE_JUVENILE); in Inst_SetMatingTypeJuvenile()
10665 if (m_organism->GetPhenotype().GetMatingType() == MATING_TYPE_JUVENILE) { in Inst_DivideSexMatingType()
10677 if (m_organism->GetPhenotype().GetMatingType() != MATING_TYPE_MALE) getIP().Advance(); in Inst_IfMatingTypeMale()
10684 if (m_organism->GetPhenotype().GetMatingType() != MATING_TYPE_FEMALE) getIP().Advance(); in Inst_IfMatingTypeFemale()
10691 if (m_organism->GetPhenotype().GetMatingType() != MATING_TYPE_JUVENILE) getIP().Advance(); in Inst_IfMatingTypeJuvenile()
10698 int counter = m_organism->GetPhenotype().GetCurMatingDisplayA(); in Inst_IncrementMatingDisplayA()
10700 m_organism->GetPhenotype().SetCurMatingDisplayA(counter); in Inst_IncrementMatingDisplayA()
10707 int counter = m_organism->GetPhenotype().GetCurMatingDisplayB(); in Inst_IncrementMatingDisplayB()
10709 m_organism->GetPhenotype().SetCurMatingDisplayB(counter); in Inst_IncrementMatingDisplayB()
10721 m_organism->GetPhenotype().SetCurMatingDisplayA(new_display); in Inst_SetMatingDisplayA()
10733 m_organism->GetPhenotype().SetCurMatingDisplayB(new_display); in Inst_SetMatingDisplayB()
10739 m_organism->GetPhenotype().SetMatePreference(mate_pref); in Inst_SetMatePreference()