Exemplo n.º 1
0
        public List <SudokuCell> LoadPuzzle(string Filename)
        {
            List <SudokuCell> result = new List <SudokuCell>();

            if (File.Exists(Filename))
            {
                List <string> puzzles = ParsePuzzleFile(Filename);

                //File.WriteAllText(filename + ".output.txt", puzzles.Aggregate((a, b)=> a + Environment.NewLine + b) );

                if (puzzles.Count > 0)
                {
                    List <int> puzzle = puzzles[StaticRandom.Instance.Next(0, puzzles.Count)].Select(c => Convert.ToInt32(c.ToString())).ToList();
                    result = StaticSudoku.TranslateBoard(puzzle);
                }
            }

            return(result);
        }
Exemplo n.º 2
0
 public string FormatCandidatesString_Compact()
 {
     return(StaticSudoku.ArrayToString(this.Candidates.Select(c => c.ToString()), ""));
 }
Exemplo n.º 3
0
 public override string ToString()
 {
     return(string.Format("({0})", StaticSudoku.ArrayToString(Values, ",")));
 }