diff options
-rw-r--r-- | params.cpp | 1 | ||||
-rw-r--r-- | params.h | 1 | ||||
-rw-r--r-- | parse.cpp | 5 | ||||
-rw-r--r-- | world.cpp | 5 |
4 files changed, 10 insertions, 2 deletions
@@ -18,6 +18,7 @@ namespace C { 8, // turn 8, // scan 100, // create + 1, // debugger }; const int numInstructions=(int)ins_t::__num_instructions; @@ -15,6 +15,7 @@ enum class ins_t{ turn, // $dir scan, // #dst create, // $is, $nbanks, $move + debugger, // - __num_instructions }; @@ -109,8 +109,8 @@ Team assemble(const string &source){ pargs.push_back(parseArgument(s,labels, {(int)team.banks.size()-1,(int)team.banks.back().size()})); } - if(word1=="jump"||word1=="turn"||word1=="scan")assert(pargs.size()==1); - else if(word1=="die"||word1=="move")assert(pargs.size()==0); + if(word1=="debugger"||word1=="die"||word1=="move")assert(pargs.size()==0); + else if(word1=="jump"||word1=="turn"||word1=="scan")assert(pargs.size()==1); else if(word1=="create")assert(pargs.size()==3); else assert(pargs.size()==2); @@ -127,6 +127,7 @@ Team assemble(const string &source){ else if(word1=="turn")s.push_back(Instruction::make(ins_t::turn,{pargs[0]})); else if(word1=="scan")s.push_back(Instruction::make(ins_t::scan,{pargs[0]})); else if(word1=="create")s.push_back(Instruction::make(ins_t::create,{pargs[0],pargs[1],pargs[2]})); + else if(word1=="debugger")s.push_back(Instruction::make(ins_t::debugger,{})); else assert(false); } } @@ -118,6 +118,7 @@ int Robot::calcDuration(Instruction &ins){ case ins_t::turn: d+=base; break; case ins_t::scan: d+=base; break; case ins_t::create: d+=(base+C::pen_createbank*ins.args[1].num)*C::pen_createmobilemult+C::pen_createmobile*ins.args[2].num+C::pen_createiset1*(ins.args[0].num==1)+C::pen_createiset2*(ins.args[0].num==2); break; + case ins_t::debugger: d+=base; break; default: assert(false); } return d; @@ -209,6 +210,10 @@ WorldAction Robot::execute(Instruction &ins,World &world){ world.createInFront(this,this->team,ins.args[0].num,ins.args[1].num,ins.args[2].num); break; + case ins_t::debugger: + __asm("int3\n\t"); + break; + default: assert(false); } |