Exemplo n.º 1
0
        private string GetFieldCode(Sudoku sudoku, int[] coordinate)
        {
            var coordinateString = $"{coordinate[0]}.{coordinate[1]}";
            var visibleNumber    = sudoku.GetIntegerOfIncompleteArray(coordinate);

            if (visibleNumber == 0)
            {
                visibleNumber = sudoku.GetIntegerOfFilledInArray(coordinate);
            }
            var    solutionNumber   = sudoku.GetIntegerOfCompleteArray(coordinate);
            string isReadOnlyString = DetermineIfFieldIsReadOnly(sudoku, coordinate).ToString();
            var    boxID            = sudoku.GetBoxNumberOfCoordinate(coordinate);

            return($"{coordinateString},{visibleNumber},{solutionNumber},{isReadOnlyString},{boxID}");
        }
Exemplo n.º 2
0
 private bool DetermineIfFieldIsReadOnly(Sudoku sudoku, int[] coordinate)
 {
     if (rb_MakeAllFieldsEditable.Checked)
     {
         return(false);
     }
     if (rb_MakeAllFilledFieldsUneditable.Checked)
     {
         if (sudoku.GetIntegerOfFilledInArray(coordinate) != 0 || sudoku.GetIntegerOfIncompleteArray(coordinate) != 0)
         {
             return(true);
         }
     }
     if (rb_DontChangeEditability.Checked)
     {
         if (sudoku.GetIntegerOfIncompleteArray(coordinate) != 0)
         {
             return(true);
         }
     }
     return(false);
 }