From 32c25651f707b13f5f0c27cf807521cf163dcacb Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Tue, 21 Mar 2017 22:49:05 +0100 Subject: Be more tolerant of bot errors --- world.cpp | 4 ++-- 1 file 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); -- cgit v1.2.3