SHARE
TWEET

try-catch to handle bounds error

a guest Aug 3rd, 2017 115 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         try{ //we use try-catch so we don't have to worry about bounds errors...
  2.             if(x1-1 == x2 && y1 == y2){ //means we found target!
  3.                 node = {x1-1, y1, node[2]+1};
  4.                 search_q.push_back(node);
  5.                 findingTarget = false;
  6.                 break;
  7.             }
  8.             if(!isIntIn(map[y1][x1-1], blocked)){//if index is *not* in blocked list
  9.                 //we also gotta make sure node isn't in queue with lower distance already...
  10.                
  11.                
  12.             }
  13.         }catch(...){
  14.             k = k; //do nothing pretty much
  15.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top