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)); }
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()); }
/// <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); } }
/// <summary> /// Sets the sudoku to a specific puzzle /// </summary> /// <param name="puzzleData">New puzzle</param> public void SetPuzzle(PuzzleData puzzleData) { _puzzleData = puzzleData; Reset(); }
public Sudoku(PuzzleData puzzleData, Point2D position) { _position = position; SetPuzzle(puzzleData); }
public void SetUp() { PuzzleData puzzleData = new PuzzleData(_puzzle, _solution); _sudoku = new Sudoku(puzzleData, new Point2D()); }