Esempio n. 1
0
        private void updateGrid()
        {
            CCell currentCell = null;

            for (int row = 0; row < CCell.SIZE; row++)
            {
                for (int column = 0; column < CCell.SIZE; column++)
                {
                    currentCell        = grid.getCell(row, column);
                    grid1.activeColumn = column;
                    grid1.activeRow    = row;
                    if (currentCell.isFixed())
                    {
                        grid1.fixedNumber = currentCell.getFixedValue();
                    }
                    else
                    {
                        grid1.possibleNumbers = currentCell.getPossibleValues();
                    }
                }
            }
        }
Esempio n. 2
0
        public CGrid(string filename)
        {
            // c:\users\klaus\documents\visual studio 2015\Projects\Sudoku\Sudoku\bin\Debug\testfile.sudoku

            string[] rows = System.IO.File.ReadAllLines(@"..\..\" + filename);
            for (int row = 0; row < CCell.SIZE; row++)
            {
                for (int column = 0; column < CCell.SIZE; column++)
                {
                    int  value;
                    bool ok = int.TryParse(rows[row][column].ToString(), out value);
                    if (ok)
                    {
                        cells[row, column] = new CCell(value);
                        numNotFixed--;
                    }
                    else
                    {
                        cells[row, column] = new CCell();
                    }
                }
            }
        }