public String toString()
- for debuggingint[] seed(int)
, with a new (?) reserved word, final
... final int[] baseCase = {1,2}; // only 2 players, 1 plays 2 ... int [] seed(int n) { // this assumes n is a power of 2 >= 2 if (n == 2) { // base case? return baseCase; return expand(seed(n/2)); // if not, recurse with n/2 } int[] expand(int[] small) { // fill in their opponents to double the size int[] returnMe = new int[small.length*2]; // twice as big ... return returnMe; } ... display(seed(8)); // test it on n=8
int[][] sq = new int[N][N];
for (int row = 0; row < N; row++) { for (int col = 0; col < N; col++) { ...sq[row][col]... }//inner for }//outer for