示例#1
0
        public CellView(CellHashset InCell)
        {
            _Cell = InCell;

            DataContext = _Cell;

            InitializeComponent();
        }
示例#2
0
        public void ReportSolvedIndex(CellHashset Cell)
        {
            _AnswerProcessing.Enqueue(Cell);

            if (_AnswerProcessing.Count == 1)
            {
                Solve();
            }
        }
示例#3
0
        private void Solve()
        {
            while (_AnswerProcessing.Count > 0)
            {
                CellHashset Answered = _AnswerProcessing.Dequeue();

                SolveForCell(Answered);

                SolveForRows();
                SolveForColumns();
                SolveForQuadrants();
            }
        }
示例#4
0
        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)));
            }
        }
示例#5
0
 private void SolveForCell(CellHashset Cell)
 {
     MarkRowSolvedForValue(Cell.StartOfRow, Cell.Answer);
     MarkColumnSolvedForValue(Cell.StartOfColumn, Cell.Answer);
     MarkQuadrantSolvedForValue(Cell.StartOfQuadrant, Cell.Answer);
 }