This is my first time trying code blocks. Have no idea how its going to turn out but giving it a try.

Figured I'd post some code snippets from a Sudoku class i've been writing. The solver code is now complete but it doesn't do input/output yet as i've been focusing on the guts. Its now able to solve any. I'll post more about this code in the next post to hopefully keep things clean and readable. Important parts are in the Solve method and specifically Selective Solutioning where the real funky stuff happens.

Code:
class SudokuGrid
{
	SudokuCell Cell[81];

	char Find_Cellblock(char, char);
	void Remove_Row_Possibilities(char, int, int);
	void Remove_Col_Possibilities(char, int, int);
	void Remove_CellBlock_Possibilities(char, int, int);
	void Remove_RowColBlock_Possibilities(int, int);
	char Solve_RowSingles();
	char Solve_ColumnSingles();
	char Solve_CellBlockSingles();
	int Solve_GridSingles();
	char Get_Offset(char, int);
	char Get_Col_Offset(char, int);
	char Remove_CellBlock_Row_Possibilities(char, char, int);
	char Remove_CellBlock_Col_Possibilities(char, char, int);
	char Remove_Row_Possibilities(char, char, int);
	char Remove_Col_Possibilities(char, char, int);
	char Remove_Row_CellBlock_Isolation_Possibilities();
	char Remove_Col_CellBlock_Isolation_Possibilities();
	char Remove_CellBlock_Row_Isolation_Possibilities();
	char Remove_CellBlock_Col_Isolation_Possibilities();
	char Selective_Solutioning();

public:
                int Get_Cell_Value(int, int);
                void Set_Cell_Value(int, int, int);
	SudokuCell *Get_Cell(int);
	void Set_Cell(int, SudokuCell *);
	void Read_File(char *Filename);
	char Is_Solved();
	char Is_Broken();
	char Solve();

	void Set_Sudoku_Grid(SudokuGrid *);
	SudokuGrid(SudokuGrid *);
	SudokuGrid(void);
	~SudokuGrid(void);
};
Code:
class SudokuCell
{
	int value;
	char *Possibilities;
	char Solved;

public:
	int Get_Value();
	void Set_Value(int);
	char *Get_Possibilities();
	void Set_Possibilities(char *);
	char Get_Solved();
	void Get_Solved(char);
	char Is_Solved();
	char Is_Broken();
	void Set_Solved(char);
	int Get_Possibility(char);
	int OnlyOnePossibility();
	char Num_Possibilities();
	char NotPossibility(int);
	char IsPossibility(int);

	SudokuCell(SudokuCell &);
	SudokuCell(void);
	~SudokuCell(void);
};
Main Solver Loop

Code:
char SudokuGrid::Solve()
{
    char Something_Changed, Solved = FALSE;
    char Broken = FALSE, a = 0, retval = UNSOLVED;

    while(Solved == FALSE && Broken == FALSE && retval == UNSOLVED)
    {
        Something_Changed = FALSE;

        while(Solve_GridSingles()) {}
        Something_Changed |= Solve_RowSingles();
        Something_Changed |= Solve_ColumnSingles();
        Something_Changed |= Solve_CellBlockSingles();

        Broken = Is_Broken();		
        Solved = Is_Solved();

        if (Something_Changed == FALSE && Solved == FALSE && Broken == FALSE)
        {
            Something_Changed |= Remove_Row_CellBlock_Isolation_Possibilities();
            Something_Changed |= Remove_Col_CellBlock_Isolation_Possibilities();
            Something_Changed |= Remove_CellBlock_Row_Isolation_Possibilities();
            Something_Changed |= Remove_CellBlock_Col_Isolation_Possibilities();

            Broken = Is_Broken();
            Solved = Is_Solved();

            if (Something_Changed == FALSE && Solved == FALSE && Broken == FALSE)
               retval = Selective_Solutioning();
        }
    }
    if (Solved)
        retval = SOLVED;
    if (Broken)
        retval = BROKEN;
    return retval;
}
And where the magic happens once the logic deductions have failed. What this is is basically a brute force method of solving the remaining grid. Its also where most people who try to do this with C functions fall down and go boom. Calling your Solve Method from a Method in your Solve function is $$.

Code:
char SudokuGrid::Selective_Solutioning()
{
    char x = 0, y = 0, CellFound = FALSE, SomethingChanged = FALSE;
    char tVal1 = 0, tVal2 = 0, retval = UNSOLVED, tPoss;
    SudokuGrid *WorkGrid;
    SudokuCell *tCell;

    while (x < 81 && retval != SOLVED && SomethingChanged == FALSE)
    {
         if (Cell[x].Is_Solved() == FALSE)
         {
            tPoss = Cell[x].Num_Possibilities();

            y = 1;
            while (y <= tPoss && retval != SOLVED)
            {
               WorkGrid = new SudokuGrid(this);
               tCell = WorkGrid -> Get_Cell(x);

               tVal1 = Cell[x].Get_Possibility(1);
               tCell -> Set_Value(tVal1 - 48);

               retval = WorkGrid -> Solve();
               if (retval == BROKEN)
                   Cell[x].NotPossibility(tVal1 - 48);
               else if (retval == SOLVED)
                   Set_Sudoku_Grid(WorkGrid);
               delete WorkGrid;
               y++;
            }
            if (retval == UNSOLVED)
               retval = BROKEN;
         }
         x++;
     }
     return retval;
}