function to check is subgrid is Magic Square
function magic ( a , b , c , d , e , f , g , h , i ) { var s1 = new Set ( [ a , b , c , d , e , f , g , h , i ] ) ; var s2 = new Set ( [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ] ) ;