コード例 #1
0
        private void MenuHint_Click(object sender, RoutedEventArgs e)
        {
            if (selectedCell != null)
            {
                List <byte> possibleNums    = sudoku.PossibleNumbers(selectedCell.GetRow(), selectedCell.GetColumn());
                string      possibleNumsStr = string.Empty;

                if (possibleNums != null)
                {
                    for (int i = 0; i < possibleNums.Count; i++)
                    {
                        possibleNumsStr += possibleNums[i];
                        if (i < possibleNums.Count - 1)
                        {
                            possibleNumsStr += ", ";
                        }
                    }

                    statusLeft.Content = $"Possible numbers for selected cell are: {possibleNumsStr}.";
                }
                else
                {
                    statusLeft.Content = $"A number is already placed in the selected cell.";
                }
            }
            else
            {
                statusLeft.Content = "You have to select a cell to get a hint.";
            }
        }