private boolean validPosition(int x, int y){
    int cx = x + xCenter;
    int cy = y + yCenter;

    if(cx < 0) return false;
    if(cy < 0) return false;
    if(cx >= walls[0].length) return false;
    if(cy >= walls.length) return false;
    return true;
  }