Elements of grid must contain all numbers from 1 to 9 , sum of all rows , columns and diagonals must be same , i . e . , 15.
if ( s1 == s2 && ( a + b + c ) == 15 && ( d + e + f ) == 15 && ( g + h + i ) == 15 && ( a + d + g ) == 15 && ( b + e + h ) == 15 && ( c + f + i ) == 15 && ( a + e + i ) == 15 && ( c + e + g ) == 15 ) return true ; return false ; }