shuffler

Programs which generate, solve, and analyze Sudoku puzzles

shuffler

Postby riezebosch » Wed Dec 08, 2021 4:12 pm

Today I started a new project: https://github.com/riezebosch/sudffler

Its goal is to transpose sudokus in a non-destructive way to generate more variants while maintaining the same grade.

The mutations already implemented are:
  • swapping rows (within a band)
  • swapping columns (within a stack)
  • swapping stacks
  • swapping bands
  • rotate clockwise
  • shuffle the numbers

Code: Select all
var builder = new Builder()
    .Shuffle("123456")
    .Stack(0).Swap(1)
    .Stack(0).Mirror()
    .Stack(0).Shuffle()
    .Stacks().Mirror()
    .Stacks().ForEach(stack => stack.Mirror())
    .Bands().ForEach(band => band.Mirror())
    .Band(0).Swap(1)
    .Band(0).Mirror()
    .Bands().Mirror()
    .Rotate();

Grid starter = "000200040030004001100600050060002000";
_output.WriteLine(builder.Apply(starter).ToString());

Grid solution = "513246246135624351135624351462462513";
_output.WriteLine(builder.Apply(solution).ToString());


Code: Select all
000600050002000130302000010004006000
564231413652632514325146156423241365
riezebosch
 
Posts: 3
Joined: 30 November 2021

Return to Software