diff options
author | tomsmeding <tom.smeding@gmail.com> | 2017-03-21 22:49:05 +0100 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2017-03-21 22:49:05 +0100 |
commit | 32c25651f707b13f5f0c27cf807521cf163dcacb (patch) | |
tree | 744304a5ba2a6b6fa4735aab9081ae7a7dce38c1 | |
parent | 07b1d9ca86567344a2dbac05f0d336890a4fb660 (diff) |
Be more tolerant of bot errors
-rw-r--r-- | world.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -24,7 +24,7 @@ WorldAction Robot::tick(World &world){ if(active==0)return WorldAction::none; // TODO: check whether `waited` needs to be reset if(!ipInRange()){ ip.bank=ip.pos=0; - assert(ipInRange()); + if(!ipInRange())return WorldAction::die; } waited++; Instruction ins=resolve(world); @@ -259,7 +259,7 @@ Robot& World::create(const Team *team,int iset,int nbanks,bool mobile){ Robot& World::create(const Team *team,int iset,int nbanks,bool mobile,int x,int y,int heading){ x = (x%SIZE + SIZE)%SIZE; // Negative values are wrapped y = (y%SIZE + SIZE)%SIZE; - assert(!board[y][x]); + if(board[y][x])return *board[y][x]; board[y][x]=new Robot(); board[y][x]->team=team; board[y][x]->banks.resize(nbanks); |