#ifndef SUDOKUBOARD_H_ #define SUDOKUBOARD_H_ /** * SudokuBoard - A class containing the information necessary to solve * a 9x9 squiggly sudoku puzzle. * * Each cell contains both a number (which the solver has placed in that * cell), and a letter (A-I) indicating the region to which the cell * belongs. * * The rows and columns of a board are numbered from 0 to 8. * * @author Programming Contest Judges * @version February 27, 2009 */ #include using namespace std; #include "apmatrix.h" #include "apstring.h" class SudokuBoard { public: /** * Construct the SudokuBoard with the given serial number. * The SudokuBoard includes both the region map and the numbers in the solution * @param serialNum - the serial number of the board being constructed */ SudokuBoard(int serialNum); /** * Returns the value in the specified cell * @param row the row of the cell whose value is to be returned * @param col the column of the cell whose value is to be returned * @return the value in the cell: (row, col) * @throws Exception if row or column are out of bounds */ int cellValue(int row, int col) const; /** * Returns the label for the region of the specified cell * @param row the row of the cell whose region is to be returned * @param col the column of the cell whose region is to be returned * @return the region of the cell: (row, col) * @throws Exception if row or column are out of bounds */ char mapValue(int row, int col) const; /** * Print the values in the board. * While potentially useful for debugging purposes, leaving a call to * this method as part of a final submission will almost certainly result * in an incorrect submission. */ void printBoard() const; /** * Print the labels for the regions in the board. * While potentially useful for debugging purposes, leaving a call to * this method as part of a final submission will almost certainly result * in an incorrect submission. */ void printRegionMap() const; private: const static int BOARD_SIZE = 9; const static int NUM_BOARDS = 9; apmatrix boardVals, regions; apmatrix board0, board1, board2, board3, board4, board5; apmatrix map0, map1, map2, map3, map4; apmatrix fillBoard(const apstring & d); void fillAllBoards(); }; #endif /* SUDOKUBOARD_H_ */