public CellView(CellHashset InCell) { _Cell = InCell; DataContext = _Cell; InitializeComponent(); }
public void ReportSolvedIndex(CellHashset Cell) { _AnswerProcessing.Enqueue(Cell); if (_AnswerProcessing.Count == 1) { Solve(); } }
private void Solve() { while (_AnswerProcessing.Count > 0) { CellHashset Answered = _AnswerProcessing.Dequeue(); SolveForCell(Answered); SolveForRows(); SolveForColumns(); SolveForQuadrants(); } }
public SudokuSolverVM() { _Cells.Clear(); for (int i = 0; i < TOTAL_CELLS; i++) { CellHashset Cell = new CellHashset(this, i, FindTheStartOfIndexRow(i), FindTheStartOfIndexColumn(i), FindTheStartOfIndexQuadrant(i)); _Cells.Add(i, Cell); //Trace.WriteLine(String.Format("Index = {0} Row = {1} Column = {2} Quadrant = {3}", i, FindTheStartOfIndexRow(i), FindTheStartOfIndexColumn(i), FindTheStartOfIndexQuadrant(i))); } }
private void SolveForCell(CellHashset Cell) { MarkRowSolvedForValue(Cell.StartOfRow, Cell.Answer); MarkColumnSolvedForValue(Cell.StartOfColumn, Cell.Answer); MarkQuadrantSolvedForValue(Cell.StartOfQuadrant, Cell.Answer); }