dyguests's Sudoku Variant C# Solver Lib

Programs which generate, solve, and analyze Sudoku puzzles

dyguests's Sudoku Variant C# Solver Lib

Postby dyguests » Fri Oct 25, 2024 8:18 am

Here is:
https://github.com/dyguests/DlxLib

Include:
    Standard Sudoku
    Killer Sudoku

Algorithm:
    DLX (Dancing Links)

Usage:

Code: Select all
const string sketch = "32586719486914327571425936819368245764793581258271463925839674143157892697642158c";

//            const string sketch = @"........1..2...........34......5.......2...3.....6.........47....6..............8
//Diagonal";

var puzzle = PuzzleSketcher.FromSketch(sketch);
var dlx = SudokuDlxUtil.ToDlx(puzzle);

foreach (var result in dlx.Solve())
{
    var solution = SudokuDlxUtil.ToSolution(puzzle, dlx.ReadonlyMatrix, result);
    puzzle.SetSolution(solution);
    Console.WriteLine($"sudoku Solution:\n{solution.DigitsToDisplay()}");
}

//var sketch = PuzzleSketcher.ToSketch(puzzle, showSolution : true, useMask: true);



Self-introduction:
Hello everyone, I'm new here.

Questions:
    Is there a standard template format for puzzle strings? I want to align with the forum's format when adding other Sudoku variant rules in the future.
    [FIXED]Can Killer Sudoku be transformed into an exact cover problem?
dyguests
 
Posts: 4
Joined: 20 August 2021

Return to Software

cron