// CSCI 3300 // Assignment: 2* // Author: *** // File: sudoku.cpp // Tab stops: *** /* **Say what this program does here** */ #include #include "intset.h" using namespace std; typedef SetOfSmallInts Puzzle[9][9]; typedef SetOfSmallInts* PuzzleSection[9]; enum SolutionStatus {solved, unsolvable, working}; //============================================================== // copyPuzzle //============================================================== // Copy puzzle p into q. For example, if p is a puzzle, then // Puzzle q; // copyPuzzle(q, p); // stores a copy of puzzle p into q. //============================================================== void copyPuzzle(Puzzle q, Puzzle p) { int i, j; for(i = 0; i < 9; i++) { for(j = 0; j < 9; j++) { } } } //============================================================== // getRow //============================================================== // Store the i-th row of puzzle p into puzzle section R. // The rows are numbered from 0 to 8. // // After doing this, the k-th set in row i is *(R[k]). // Do not omit *(...). The cells in the row are numbered // 0,1,...,8. //============================================================== void getRow(PuzzleSection R, Puzzle p, int i) { int j; for(j = 0; j < 9; j++) { R[j] = &(p[i][j]); } } //============================================================== // getColumn //============================================================== // Store the j-th column of puzzle p into puzzle section R. // The columns are numbered from 0 to 8. // // After doing this, the k-th set in column j is // *(R[i]). Do not omit *(...). The cells in the // column are numbered 0,1,...,8. //============================================================== void getColumn(PuzzleSection R, Puzzle p, int j) { int i; for(i = 0; i < 9; i++) { R[i] = &(p[i][j]); } } //============================================================== // getSquare //============================================================== // Store the k-th square of puzzle p into puzzle section R. // The squares are numbered as follows. // 0 1 2 // 3 4 5 // 6 7 8 // For example, square 4 is the middle square in the puzzle. // // After doing getSquare, the i-th set in the square is *(R[i]). // Do not omit *(...). The cells in the square are numbered // 0,1,...,8, in the same pattern shown above for the squares // themselves. For example *(R[3]) is the first position in // the second row of the square. //============================================================== void getSquare(PuzzleSection R, Puzzle p, int k) { int i; for(i = 0; i < 9; i++) { R[i] = &(p[k - k%3 + i/3][3*(k%3) + i%3]); } } //============================================================== // main //============================================================== int main(int argc, char** argv) { return 0; }