function ncount(i,j,bSize) {
            var i1 = i+bSize;
            var i2 = i-bSize;
            var j1 = j+bSize;
            var j2 = j-bSize;
            var neighbors = 0;
            if(iswall(i1,j1) == 1) {
                neighbors++;
            }
            if(iswall(i,j1) == 1) {
                neighbors++;
            }
            if(iswall(i2,j1) == 1) {
                neighbors++;
            }
            if(iswall(i1,j) == 1) {
                neighbors++;
            }
            if(iswall(i2,j) == 1) {
                neighbors++;
            }
            if(iswall(i1,j2) == 1) {
                neighbors++;
            }
            if(iswall(i,j2) == 1) {
                neighbors++;
            }
            if(iswall(i2,j2) == 1) {
                neighbors++;
            }
            return neighbors;
        }
//functions for finding how many neighbors are walls
functions for finding how many neighbors are walls
functions for finding how many neighbors are walls
function ncount(i,j,bSize) {
            var i1 = i+bSize;
            var i2 = i-bSize;
            var j1 = j+bSize;
            var j2 = j-bSize;
            var neighbors = 0;
            if(iswall(i1,j1) == 1) {
                neighbors++;
            }
            if(iswall(i,j1) == 1) {
                neighbors++;
            }
            if(iswall(i2,j1) == 1) {
                neighbors++;
            }
            if(iswall(i1,j) == 1) {
                neighbors++;
            }
            if(iswall(i2,j) == 1) {
                neighbors++;
            }
            if(iswall(i1,j2) == 1) {
                neighbors++;
            }
            if(iswall(i,j2) == 1) {
                neighbors++;
            }
            if(iswall(i2,j2) == 1) {
                neighbors++;
            }
            return neighbors;
        }
function ncount ( i , j , bSize ) { var i1 = i + bSize ; var i2 = i - bSize ; var j1 = j + bSize ; var j2 = j - bSize ; var neighbors = 0 ; if ( iswall ( i1 , j1 ) == 1 ) { neighbors ++ ; } if ( iswall ( i , j1 ) == 1 ) { neighbors ++ ; } if ( iswall ( i2 , j1 ) == 1 ) { neighbors ++ ; } if ( iswall ( i1 , j ) == 1 ) { neighbors ++ ; } if ( iswall ( i2 , j ) == 1 ) { neighbors ++ ; } if ( iswall ( i1 , j2 ) == 1 ) { neighbors ++ ; } if ( iswall ( i , j2 ) == 1 ) { neighbors ++ ; } if ( iswall ( i2 , j2 ) == 1 ) { neighbors ++ ; } return neighbors ; }
functions for finding how many neighbors are walls
functions for finding how many neighbors are walls