Esempio n. 1
0
 // Comprueba si las filas, las columnas y los cuadrantes son correctos según las reglas del sudoku
 private void CheckSudoku()
 {
     if (AreValidRows() && AreValidColumns() && AreValidQuadrants())
     {
         SudokuSolved?.Invoke();
     }
     else
     {
         SudokuWrong?.Invoke();
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 플레이어가 채운 셀을 기반으로 스도쿠의 현재 진행 상황을 반환합니다.
        /// </summary>
        public double GetProgress()
        {
            if (InitiallyFilledSudokuCellsCount == MaxFilledSudokuCellsCount)
            {
                return(100);
            }

            int playerFilledCells = SudokuUtils.GetFilledSudokuCellsCount(currentSudokuGrid.ToArray(), true);

            double progress = playerFilledCells / (double)(MaxFilledSudokuCellsCount - InitiallyFilledSudokuCellsCount) * 100;

            if (progress == 100)
            {
                SudokuSolved?.Invoke(this, new EventArgs());
            }

            return(progress);
        }