From 78306cfce58ac111b8e5868de93982e8e95bd4e3 Mon Sep 17 00:00:00 2001 From: Austin Ferguson Date: Mon, 4 Jul 2022 15:10:55 -0400 Subject: [PATCH] Switch VCPU inst methods from using index to ID --- include/emp/hardware/VirtualCPU.hpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/include/emp/hardware/VirtualCPU.hpp b/include/emp/hardware/VirtualCPU.hpp index e514fab198..ba5ed2ba82 100644 --- a/include/emp/hardware/VirtualCPU.hpp +++ b/include/emp/hardware/VirtualCPU.hpp @@ -230,17 +230,19 @@ namespace emp{ } /// Return the first instruction in the instruction library inst_t GetDefaultInst() const{ - return inst_t(0, GetInstLib()->GetID(0)); + return inst_t(GetInstLib()->GetIndex(0), 0); } /// Add one or more default instructions to the end of the genome void PushDefaultInst(size_t count=1) { - PushInst( inst_t(0, GetInstLib()->GetID(0)), count ); + PushInst( inst_t(GetInstLib()->GetIndex(0), 0), count ); nops_need_curated = true; } /// Return a random instruction from the instruction library inst_t GetRandomInst(Random & rand) { - size_t idx = rand.GetUInt(GetInstLib()->GetSize()); - size_t id = GetInstLib()->GetID(idx); + size_t id = rand.GetUInt(GetInstLib()->GetSize()); + size_t idx = GetInstLib()->GetIndex(id); + //size_t idx = rand.GetUInt(GetInstLib()->GetSize()); + //size_t id = GetInstLib()->GetID(idx); return inst_t(idx, id); } /// Overwrite the instruction at the given genome index with passed instruction