protected abstract List <SudokuSolution> Solve_BoxLineReduction(SudokuBoard a_board, bool a_all);
protected abstract List <SudokuSolution> Solve_NakedQuads(SudokuBoard a_board, bool a_all);
protected abstract List <SudokuSolution> Solve_PointingTriples(SudokuBoard a_board, bool a_all);
protected abstract List <SudokuSolution> Solve_SinglesInUnit(SudokuBoard a_board, bool a_all);
protected abstract List <SudokuSolution> Solve_HiddenTriples(SudokuBoard a_board, bool a_all);
protected abstract List <SudokuSolution> Solve_WXYZWing(SudokuBoard a_board, bool a_all);
public static SudokuSolution Rotate(this SudokuSolution a_sol, SudokuBoard a_board) { return(new SudokuSolution(a_sol.Type, Rotate(a_sol.Removed, a_board), Rotate(a_sol.Stayed, a_board), Rotate(a_sol.Solved, a_board), from unit in a_sol.ColorUnits select Rotate(unit, a_board))); }
private static SudokuBoard LoadFromText(string a_str) { a_str = a_str.Replace(System.Environment.NewLine, System.Environment.NewLine.Substring(0, 1)); List <string> lines = a_str.Split(System.Environment.NewLine[0]).ToList(); for (int i = lines.Count - 1; i >= 0; i--) { lines[i] = lines[i].Replace(" ", ""); if (lines[i].IndexOfAny(new char[] { ']', '[', '-', '+', '*' }) != -1) { lines.RemoveAt(i); } else if (lines[i].Length == 0) { lines.RemoveAt(i); } } if (lines.Count == 1) { string str = lines[0]; if (str.Length == 9 * 9) { lines.Clear(); for (int i = 0; i < 9; i++) { lines.Add(str.Substring(i * 9, 9)); } } } for (int i = lines.Count - 1; i >= 0; i--) { lines[i] = lines[i].Replace(" |", ""); lines[i] = lines[i].Replace("|", ""); lines[i] = lines[i].Replace(" ", "."); } for (int i = lines.Count - 1; i >= 0; i--) { if (lines[i].Length != SIZE) { lines.RemoveAt(i); } } if (lines.Count != SIZE) { return(null); } SudokuBoard board = new SudokuBoard(); (from cell in board.Cells() where lines[cell.Row][cell.Col] != '.' select cell).ForEach(cell => cell[Int32.Parse(new string(new char[] { lines[cell.Row][cell.Col] })) - 1].State = SudokuNumberState.sudokucellstateManualEntered); if (!board.Check()) { return(null); } return(board); }
public SudokuBoard(SudokuBoard a_board) : this() { Cells().ForEach(cell => cell.CopyFrom(a_board[cell.Col, cell.Row])); }
internal SudokuSolutionNode AddNode(SudokuBoard a_board, SudokuSolutionNodeState a_state, SudokuSolution a_solution) { return(AddNode(new SudokuSolutionNode(a_board, a_state, a_solution))); }
public static SudokuSolutionNode CreateRoot(SudokuBoard a_board) { return(new SudokuSolutionNode(a_board, SudokuSolutionNodeState.State)); }
internal SudokuSolutionNode AddNode(SudokuBoard a_board, SudokuSolutionNodeState a_state) { return(AddNode(a_board, a_state, null)); }
private static IEnumerable <SudokuNumber> Rotate(IEnumerable <SudokuNumber> a_list, SudokuBoard a_board) { var list = from num in a_list select Rotate(num, a_board); return(from num in list orderby num.Row, num.Col select num); }
private static IEnumerable <SudokuCell> Rotate(IEnumerable <SudokuCell> a_list, SudokuBoard a_board) { var list = from cell in a_list select GetRotatedCell(a_board, cell); return(from cell in list orderby cell.Row, cell.Col select cell); }
protected abstract List <SudokuSolution> Solve_MultivalueXWing(SudokuBoard a_board, bool a_all);
protected abstract List <SudokuSolution> Solve_MarkImpossibles(SudokuBoard a_board, bool a_all);
protected abstract List <SudokuSolution> Solve_JellyFish(SudokuBoard a_board, bool a_all);
protected abstract List <SudokuSolution> Solve_MarkSolved(SudokuBoard a_board, bool a_all);
//Constructors public Detection(SudokuBoard sudoku) { this.sudoku = sudoku; }
public static SudokuIntermediateSolution Rotate(this SudokuIntermediateSolution a_inter_sol) { SudokuBoard before = Rotate(a_inter_sol.Before); return(new SudokuIntermediateSolution(before, Rotate(a_inter_sol.After), Rotate(a_inter_sol.Solution, before))); }