Questions tagged [sudoku]

Sudoku (soo-doh-koo) is a number-placement logic puzzle. The objective is to fill a partially constructed 9×9 grid with digits so that each column, each row, and each of the nine 3×3 sub-grids that compose the grid contain all of the digits from 1 to 9.

Completed puzzles are always a type of Latin square with an additional constraint on the contents of individual regions. For example, the same integer may not appear twice in a given row, column, or any of the nine 3×3 sub-regions of the 9×9 playing board. In each puzzle the player must build a solution around a subset of pre-filled digits.

The puzzle was popularized in 1986 by the Japanese puzzle company Nikoli under the name Sudoku, meaning single number. It became an international hit in 2005.

A great deal of literature has been written about solving Sudoku puzzles and they present a very interesting and common subject for mathematicians and programmers. Solving complex Sudoku puzzles may involve combinatorics, group theory, computational complexity, guessing and backtracking. The total number of distinct grids has been calculated as approximately 6.671×1021, so brute-forcing complex puzzles may not always be successful in a desirable timeframe.

The following resources explore the logic and mathematics behind Sudoku puzzles in greater detail:

History:

Number puzzles appeared in newspapers in the late 19th century, when French puzzle setters began experimenting with removing numbers from magic squares. Le Siècle, a Paris-based daily, published a partially completed 9×9 magic square with 3×3 sub-squares on November 19, 1892. It was not a Sudoku because it contained double-digit numbers and required arithmetic rather than logic to solve, but it shared key characteristics: each row, column and sub-square added up to the same number.

On July 6, 1895, Le Siècle's rival, La France, refined the puzzle so that it was almost a modern Sudoku. It simplified the 9×9 magic square puzzle so that each row, column and broken diagonals contained only the numbers 1–9, but did not mark the sub-squares. Although they are unmarked, each 3×3 sub-square does indeed comprise the numbers 1–9 and the additional constraint on the broken diagonals leads to only one solution.

These weekly puzzles were a feature of French newspapers such as L'Echo de Paris for about a decade but disappeared about the time of World War I.

According to Will Shortz, the modern Sudoku was most likely designed anonymously by Howard Garns, a 74-year-old retired architect and freelance puzzle constructor from Indiana, and first published in 1979 by Dell Magazines as Number Place (the earliest known examples of modern Sudoku). Garns's name was always present on the list of contributors in issues of Dell Pencil Puzzles and Word Games that included Number Place, and was always absent from issues that did not. He died in 1989 before getting a chance to see his creation as a worldwide phenomenon. It is unclear if Garns was familiar with any of the French newspapers listed above.

The puzzle was introduced in Japan by Nikoli in the paper Monthly Nikolist in April 1984 as Sūji wa dokushin ni kagiru (数字は独身に限る?), which can be translated as "the digits must be single" or "the digits are limited to one occurrence." (In Japanese,"dokushin" means an "unmarried person".) At a later date, the name was abbreviated to Sudoku(數獨) by Maki Kaji (鍜治 真起 Kaji Maki?), taking only the first kanji of compound words to form a shorter version. In 1986, Nikoli introduced two innovations: the number of givens was restricted to no more than 32, and puzzles became "symmetrical" (meaning the givens were distributed in rotationally symmetric cells). It is now published in mainstream Japanese periodicals, such as the Asahi Shimbun.

Wikipedia Article: http://en.wikipedia.org/wiki/Sudoku

1192 questions
-6
votes
1 answer

How to design Grids for sudoku in Android

I am designing a sudoku game in android.I have tried 81 text views. It shows me, it is a bad idea using 81 text views. I don't know how to use canvas. So can you help to get through this?
Sasi Krishna
  • 1
  • 1
  • 1
  • 2
-7
votes
1 answer

Why does my project produce a "code too large" error at compile time?

I have this code and when I try to compile it, it returns: E:\temp\JavaApplication12\src\javaapplication12\JavaApplication12.java:15: error: code too large public static void main(String[] args) { 1 error My code is a sudoku solver. First I…
youyou
  • 1
  • 1
  • 2
-7
votes
1 answer

Code is not giving expected result in sudoku

I have written the basic logic to match 2D array, but the result are bit unexpected if(mat1[i][j] == mat2[i][j]) //what this line do public static final int[][] n_1 = {{10,12,6,-1,-1},{-1,0,8,2,-1},{0,0,0,-1,0},{0,0,0,0,0},{-1,9,0,0,-1}}; public…
Maveňツ
  • 1
  • 12
  • 50
  • 89
-8
votes
2 answers

Checking Sudoku solution

Rule for checking the correct solution for a sudoku problem are :- Grid size is 9x9, divided into 9 regions of 3x3 Each row must contain all digits from 1-9 Each column must contain all digits from 1-9 Each 3x3 square must contain all digits from…
AbDutt
  • 3
  • 1
-9
votes
1 answer

Can you explain the assign function in Norvig's Sudoku code?

I have this Python code used by Peter Norvig in his Sudoku solver. I don't understand why assign should do anything at all to 'values' because because no where in the code does 'values' get updated and 'values' is only used in the if conditional…
wdc
  • 99
  • 3
1 2 3
79
80