the_eight_queens_solver
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
the_eight_queens_solver [2012/02/21 07:52] – xjia | the_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]; | ||
| | ||
- | | + | |
- | | + | fillIntArray(row, 0); |
- | | + | |
- | | + | |
+ | | ||
| | ||
search(N, row, col, d, 0); | search(N, row, col, d, 0); | ||
Line 24: | Line 25: | ||
} | } | ||
- | void fill(int[] a, int v) { | + | int printBoard(int[] col) { |
- | int i; | + | |
- | + | ||
- | for (i = 0; i < a.length; i = i+1) { | + | |
- | a[i] = v; | + | |
- | } | + | |
- | } | + | |
- | + | ||
- | void printBoard(int[] col) { | + | |
int i, j; | int i, j; | ||
| | ||
Line 43: | Line 36: | ||
} | } | ||
} | } | ||
- | | + | |
} | } | ||
- | | + | |
} | } | ||
- | void search(int N, int[] row, int[] col, int[][] d, int c) { | + | int search(int N, int[] row, int[] col, int[][] d, int c) { |
int r; | int r; | ||
| | ||
Line 65: | Line 58: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | Note that '' |
the_eight_queens_solver.1329810723.txt.gz · Last modified: 2012/02/21 07:52 by xjia