Exemplo n.º 1
0
        public CellView(CellHashset InCell)
        {
            _Cell = InCell;

            DataContext = _Cell;

            InitializeComponent();
        }
Exemplo n.º 2
0
        public void ReportSolvedIndex(CellHashset Cell)
        {
            _AnswerProcessing.Enqueue(Cell);

            if (_AnswerProcessing.Count == 1)
            {
                Solve();
            }
        }
Exemplo n.º 3
0
        private void Solve()
        {
            while (_AnswerProcessing.Count > 0)
            {
                CellHashset Answered = _AnswerProcessing.Dequeue();

                SolveForCell(Answered);

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