private boolean [ ] generateRow ( boolean [ ] rowValues , int x , int y , int num ) { // clear the scratch array for ( int i = 0 ; i < rowValues . length ; ++ i ) { rowValues [ i ] = false ; } // find the square coordinates int xBox = ( int ) x / squareXSize ; int yBox = ( int ) y / squareYSize ; // mark the column rowValues [ x * size + num - 1 ] = true ; // mark the row rowValues [ size * size + y * size + num - 1 ] = true ; // mark the square rowValues [ 2 * size * size + ( xBox * squareXSize + yBox ) * size + num - 1 ] = true ; // mark the cell rowValues [ 3 * size * size + size * x + y ] = true ; return rowValues ; }
Create a row that places num in cell x y .