aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-03-21 22:49:05 +0100
committertomsmeding <tom.smeding@gmail.com>2017-03-21 22:49:05 +0100
commit32c25651f707b13f5f0c27cf807521cf163dcacb (patch)
tree744304a5ba2a6b6fa4735aab9081ae7a7dce38c1
parent07b1d9ca86567344a2dbac05f0d336890a4fb660 (diff)
Be more tolerant of bot errors
-rw-r--r--world.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/world.cpp b/world.cpp
index 1d5efa3..7b2d565 100644
--- a/world.cpp
+++ b/world.cpp
@@ -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);