MCPcopy Create free account
hub / github.com/devosoft/avida / PrintMiniTraceStatus

Method PrintMiniTraceStatus

avida-core/source/cpu/cHardwareExperimental.cc:883–958  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

881}
882
883void cHardwareExperimental::PrintMiniTraceStatus(cAvidaContext& ctx, ostream& fp)
884{
885 // basic status info
886 fp << m_cycle_count << " ";
887 fp << m_world->GetStats().GetUpdate() << " ";
888 for (int i = 0; i < NUM_REGISTERS; i++) {
889 DataValue& reg = m_threads[m_cur_thread].reg[i];
890 fp << GetRegister(i) << " ";
891 fp << "(" << reg.originated << ") ";
892 }
893 // genome loc info
894 fp << m_cur_thread << " ";
895 fp << getIP().GetPosition() << " ";
896 fp << getHead(nHardware::HEAD_READ).GetPosition() << " ";
897 fp << getHead(nHardware::HEAD_WRITE).GetPosition() << " ";
898 fp << getHead(nHardware::HEAD_FLOW).GetPosition() << " ";
899 // last output
900 fp << m_last_output << " ";
901 // phenotype/org status info
902 fp << m_organism->GetPhenotype().GetMerit().GetDouble() << " ";
903 fp << m_organism->GetPhenotype().GetCurBonus() << " ";
904 fp << m_organism->GetForageTarget() << " ";
905 if (m_organism->HasOpinion()) fp << m_organism->GetOpinion().first << " ";
906 else fp << -99 << " ";
907 // environment info / things that affect movement
908 fp << m_organism->GetOrgInterface().GetCellID() << " ";
909 if (m_use_avatar) fp << m_organism->GetOrgInterface().GetAVCellID() << " ";
910 if (!m_use_avatar) fp << m_organism->GetOrgInterface().GetFacedDir() << " ";
911 else fp << m_organism->GetOrgInterface().GetAVFacing() << " ";
912 if (!m_use_avatar) fp << m_organism->IsNeighborCellOccupied() << " ";
913 else fp << m_organism->GetOrgInterface().FacedHasAV() << " ";
914 const cResourceLib& resource_lib = m_world->GetEnvironment().GetResourceLib();
915 Apto::Array<double> cell_resource_levels;
916 if (!m_use_avatar) cell_resource_levels = m_organism->GetOrgInterface().GetFacedCellResources(ctx);
917 else cell_resource_levels = m_organism->GetOrgInterface().GetAVFacedResources(ctx);
918 int wall = 0;
919 int hill = 0;
920 for (int i = 0; i < resource_lib.GetSize(); i++) {
921 if (resource_lib.GetResource(i)->GetHabitat() == 2) {
922 double wall_level = 0.0;
923 if (!m_use_avatar) wall_level = m_organism->GetOrgInterface().GetFacedResourceVal(ctx, i);
924 else wall_level = m_organism->GetOrgInterface().GetAVFacedResourceVal(ctx, i);
925 if (wall_level > 0) wall = 1;
926 }
927 else if (resource_lib.GetResource(i)->GetHabitat() == 1) {
928 double hill_level = 0.0;
929 if (!m_use_avatar) hill_level = m_organism->GetOrgInterface().GetFacedResourceVal(ctx, i);
930 else hill_level = m_organism->GetOrgInterface().GetAVFacedResourceVal(ctx, i);
931 if (hill_level > 0) hill = 1;
932 }
933 if (hill == 1 && wall == 1) break;
934 }
935 fp << hill << " ";
936 fp << wall << " ";
937 // instruction about to be executed
938 cString next_name(GetInstSet().GetName(IP().GetInst()));
939
940 fp << next_name << " ";

Callers

nothing calls this directly

Calls 15

GetUpdateMethod · 0.80
GetForageTargetMethod · 0.80
GetHabitatMethod · 0.80
GetStatsMethod · 0.45
GetPositionMethod · 0.45
GetDoubleMethod · 0.45
GetMeritMethod · 0.45
GetCurBonusMethod · 0.45
HasOpinionMethod · 0.45
GetCellIDMethod · 0.45
GetAVCellIDMethod · 0.45
GetFacedDirMethod · 0.45

Tested by

no test coverage detected