Пример #1
0
        public void TestValidNonUserSetCellIsDefaultValue()
        {
            string     puzzle     = new string('2', 81);
            PuzzleData puzzleData = new PuzzleData(puzzle, _solution);

            _sudoku = new Sudoku(puzzleData, new Point2D());
            Assert.IsTrue(_sudoku.IsDefaultCell(1, 1));
        }
Пример #2
0
        public void TestIsSolvedWhenPuzzleIsComplete()
        {
            string     solution   = new string('1', 81);
            PuzzleData puzzleData = new PuzzleData(solution, solution);

            _sudoku = new Sudoku(puzzleData, new Point2D());
            Assert.IsTrue(_sudoku.IsSolved());
        }
Пример #3
0
 /// <summary>
 /// Loads a list of puzzles from a csv file
 /// </summary>
 /// <param name="file">File path to csv file</param>
 public static void LoadPuzzles(string file)
 {
     string[] lines = File.ReadAllLines(file);
     foreach (string line in lines)
     {
         string[]   data   = line.Split(',');
         PuzzleData puzzle = new PuzzleData(data[0], data[1]);
         _puzzles.Add(puzzle);
     }
 }
Пример #4
0
 /// <summary>
 /// Sets the sudoku to a specific puzzle
 /// </summary>
 /// <param name="puzzleData">New puzzle</param>
 public void SetPuzzle(PuzzleData puzzleData)
 {
     _puzzleData = puzzleData;
     Reset();
 }
Пример #5
0
 public Sudoku(PuzzleData puzzleData, Point2D position)
 {
     _position = position;
     SetPuzzle(puzzleData);
 }
Пример #6
0
        public void SetUp()
        {
            PuzzleData puzzleData = new PuzzleData(_puzzle, _solution);

            _sudoku = new Sudoku(puzzleData, new Point2D());
        }