aboutsummaryrefslogtreecommitdiff
path: root/world.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'world.cpp')
-rw-r--r--world.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/world.cpp b/world.cpp
index 2ca362e..86c805e 100644
--- a/world.cpp
+++ b/world.cpp
@@ -48,7 +48,7 @@ uint16_t* Robot::resolveVar(const Argument &arg,World &world){
Instruction Robot::resolve(World &world){
Instruction ins=banks.at(ip.bank).at(ip.pos);
- cout<<this<<" Resolving "<<ins<<endl;
+ // cout<<this<<" Resolving "<<ins<<endl;
vector<bool> dstvar(ins.args.size(),false);
if(ins.op==ins_t::set||ins.op==ins_t::add||ins.op==ins_t::sub||ins.op==ins_t::scan){
assert(dstvar.size()>0);
@@ -112,7 +112,7 @@ int Robot::calcDuration(Instruction &ins){
}
WorldAction Robot::execute(Instruction &ins,World &world){
- cout<<this<<" Executing "<<ins<<endl;
+ // cout<<this<<" Executing "<<ins<<endl;
WorldAction action=WorldAction::none;
switch(ins.op){
case ins_t::set:{
@@ -303,6 +303,17 @@ Robot* World::targetbot(const Robot *r){
return *targetbotptr(r);
}
+void World::print() const {
+ for(int y=0;y<SIZE;y++){
+ for(int x=0;x<SIZE;x++){
+ if(board[y][x]==nullptr)cout<<"..";
+ else cout<<string(2,"^>v<"[board[y][x]->heading%4]);
+ cout<<' ';
+ }
+ cout<<endl;
+ }
+}
+
ostream& operator<<(ostream &os,const Argument &arg){
if(arg.remote){