

Possible values will be shown as red if their direction is horizontal and green if vertical. An identical process is used for columns in cubes (vertical direction). This is a row, so the direction of influence of the exclusive values is horizontal. If the possible values of cells are exclusive to a single row of 3 cells in a cube, then no cells in remaining six cells of the puzzle row can contain those exclusive possibles. If that results in a cell having only one possible left, then that is added to a stack and the code loops processing cells until there are no more cells on the stack.

If the user types a number into the red cell, then that number is removed from the possibles of all cells in the blue area. 1. Simple Cube, Row and Column Elimination The 81 cells are also arranged in to nine cubes each containing nine cells. These will probably be very familiar to fellow Sudoku solvers but being self taught, they will have different names and terminology. The grid is contained within a Viewbox which provides automatic rescaling. Turns out they are quite easy, if you’ve written a custom control before, a lot of it will be familiar. I couldn’t find much information online about writing layout panels so I reverse engineered the UniformGrid using ILSpy. The View contains a custom layout panel SudokuGrid that is used to arrange the cells and the grid lines. When the model function returns, the two cell lists are compared and the view model list updated if required which redraws the cell. It determines which action is required and calls the appropriate model function, be it Add, Edit, Delete etc. When a user changes the puzzle, a callback in the ViewModel is executed. The ViewModel also contains a list of 81 cells this time stored in an ObservableCollection. The puzzle isn't actually rotated, the code simply changes the way each cell's coordinates are converted into an array index. The other notable point is that instead of writing two functions to implement a strategy, one for rows and another very similar version for columns I simply write the rows version, rotate the puzzle then call the rows function again. The list is actually a bit field which allows the use of boolean algebra to aid the required pattern matching. To that end, each cell contains a list of possible cell values which is then updated by the strategies. The trick to solving Sudoku puzzles is not to find out where numbers go directly, but is to find out where they cannot and when there is only one possibility left that must be it. The Model contains all the solving strategies and a single dimension array of 81 cells. The program structure follows a minimal MVVM design pattern. The code will attempt to solve the puzzle on the fly each time the user changes it. It uses the MahApps library to provide a icon less window and also an easy implementation of a dark mode.

I was pretty sure there was a strategy that I was missing, and this program would confirm it. I’ve converted all the strategies that I know into code which will never get bored and make mistakes. It may be obvious and I just cannot see it. Sometimes, I can get stuck on a puzzle and it can get a bit boring just going through all the strategies to try and find the next number. Watch the videos to check out all the rules, tips and strategies of Sudoku and enjoy the game! About EasybrainĮasybrain is a mobile games publisher with the most popular Sudoku app on the App Store and Google Play, and from August 2018 is the proud owner of the website.Being a self taught Sudoku puzzle solver, I do enjoy solving the puzzles themselves but the real challenge is working out the strategies you need to solve them. Our Sudoku guide has a lot of tutorial videos for players of all skill levels: from Sudoku absolute beginners to experts. However, in order to solve difficult levels and deal with them quickly, you need to use some tricks and learn advanced Sudoku techniques. Therefore it’s not so difficult to cope with the solution if you are familiar with the basic rules. There are already many numbers filled in on the grid in the simple Sudoku puzzles. The game is over when the whole Sudoku grid is correctly filled with numbers.

Each number in the 3×3 block, vertical column or horizontal row can be used only once.Each horizontal row can only contain numbers from 1 to 9.Each vertical column can only contain numbers from 1 to 9.Each 3×3 block can only contain numbers from 1 to 9.Its rules are quite simple, so even beginners can handle the simple levels. Sudoku is a popular logic puzzle with numbers. What is Sudoku and what are the rules of this game?
