Returns the number of empty squares adjacent to ( x , y )
int getDegree ( int a [ ] , int x , int y ) { int count = 0 ; for ( int i = 0 ; i < N ; ++ i ) if ( isempty ( a , ( x + cx [ i ] ) , ( y + cy [ i ] ) ) ) count ++ ; return count ; }