User Tools

Site Tools


the_eight_queens_solver

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
the_eight_queens_solver [2012/02/21 07:35] xjiathe_eight_queens_solver [2012/02/23 14:02] (current) xjia
Line 2: Line 2:
 /* The eight queens solver */ /* The eight queens solver */
  
-int main(string[] args) {+int main(string[ ] args) {
   int N;   int N;
   int[] row, col;   int[] row, col;
Line 14: Line 14:
   d[1] = new int[N+N-1];   d[1] = new int[N+N-1];
      
-  fill(row, 0); +  // fillIntArray is a contributed function 
-  fill(col, 0); +  fillIntArray(row, 0); 
-  fill(d[0], 0); +  fillIntArray(col, 0); 
-  fill(d[1], 0);+  fillIntArray(d[0], 0); 
 +  fillIntArray(d[1], 0);
      
   search(N, row, col, d, 0);   search(N, row, col, d, 0);
      
-  return 0; 
-} 
- 
-int fill(int[] a, int v) { 
-  int i; 
-   
-  for (i = 0; i < a.length; i = i+1) { 
-    a[i] = v; 
-  } 
   return 0;   return 0;
 } }
Line 44: Line 36:
       }       }
     }     }
-    printLine("");+    printChar('\n');
   }   }
-  printLine("")+  printChar('\n');
-  return 0;+
 } }
  
Line 65: Line 56:
     }     }
   }   }
-  return 0; 
 } }
 </code> </code>
 +
 +Note that ''fillIntArray'' is a [[contributed_functions|contributed function]].
the_eight_queens_solver.1329809756.txt.gz · Last modified: 2012/02/21 07:35 by xjia

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki