From 0e7a419f55dfed12fd60a0cd41be324a398673f9 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Wed, 1 Mar 2017 17:23:43 +0100 Subject: Execute some instructions! --- main.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index ce93d37..a4c8714 100644 --- a/main.cpp +++ b/main.cpp @@ -63,8 +63,13 @@ void lowercase(string &str){ Argument parseArgument(const string &str,const unordered_map &labels,Location ip){ if(str[0]=='#'||str[0]=='%'){ bool remote=str[0]=='%'; - if(isdigit(str[1]))return {arg_t::var,remote,atoi(str.data()+1),{}}; - else return {arg_t::name,remote,0,str.substr(1)}; + if(isdigit(str[1])){ + int num=atoi(str.data()+1); + assert(num>=1&&num<=20); + return {arg_t::var,remote,num,{}}; + } else { + return {arg_t::name,remote,0,str.substr(1)}; + } } else if(str[0]=='@'){ if(labels.find(str.substr(1))==labels.end()){ return {arg_t::undeflabel,false,0,str.substr(1)}; @@ -220,6 +225,7 @@ int main(int argc,char **argv){ Robot &r=world.create(&t,2,t.banks.size(),false); for(int i=0;i<(int)t.banks.size();i++){ r.load(i,t.banks[i]); + r.active=1; } } -- cgit v1.2.3-70-g09d2