private bool SolveCommandCanExecute(object parameter) { string str = ""; bool isCorrect = true; if (NumData.Length == 81 && NumData.ToList().TrueForAll(c => '0' <= c && c <= '9')) { int xynum = 0; var boardMatrix = Utility.GetInit2DimArray <int>(Utility.ROW, Utility.COL); for (int i = 0; i < Utility.ROW; i++) { for (int j = 0; j < Utility.COL; j++) { boardMatrix[i][j] = NumData[xynum++] - '0'; } } isCorrect = !Utility.Mistake(boardMatrix, "入力盤面"); str += isCorrect ? "" : "ありえない盤面です\n"; } else { str += NumData.Length != 0 ? "入力に過不足があります\n" : ""; } str += NumData.ToList().TrueForAll(c => '0' <= c && c <= '9') ? "" : "入力は半角数字のみです\n"; Log = str; return(isCorrect && NumData.Length == 81 && NumData.ToList().TrueForAll(c => '0' <= c && c <= '9')); }
public static Exp ToExp(this Data?data) { return(data switch { null => CoreImplementations.emptyList, NumData n => n.Value, PairData pair => CoreImplementations.Pair(pair.Value.ToExp(), pair.Next.ToExp()), _ => throw new NotSupportedException($"{data}") });