Skip to main content

Questions tagged [sudoku]

Sudoku (数独 sūdoku?, すうどく) English pronunciation: /suːˈdoʊkuː/ soo-doh-koo is a logic-based, combinatorial number-placement puzzle. The objective is to fill a 9×9 grid with digits so that each column, each row, and each of the nine 3×3 sub-grids that compose the grid (also called "boxes", "blocks", "regions", or "sub-squares") contain all of the digits from 1 to 9. The puzzle setter provides a partially completed grid, which typically has a unique solution.

Filter by
Sorted by
Tagged with
8 votes
4 answers
605 views

DIY Sudoku Solver (Windows Console App)

This will be somewhat larger than many Code Review posts. In a recent CR thread, an invitation was extended for me to post my DIY Sudoku solver. For the fun of it, here we are... I'm buzzing with ...
Fe2O3's user avatar
  • 1,947
4 votes
1 answer
126 views

Generic Algorithm X implementation with dancing links (DLX)

This is a generic implementation of Knuth's "Algorithm X" using dancing links. The whole code with a "mandatory" sudoku solver can be found at gitlab. Regarding the scope of the ...
TorbenPutkonen's user avatar
3 votes
1 answer
119 views

Messy Sudoku solver

I have made a simple Sudoku solver in python and TKinter. However, I have used code from many different sources, so it is not neat. I can only write ugly code, so it is just about impossible for me to ...
Pazzel's user avatar
  • 33
1 vote
1 answer
108 views

2 slow and barely working sudoku solving implementations

The code below is working however, if more zeros (empty cells) are added to the sudoku grid g, it takes longer to run, if it ever finishes. ...
watch-this's user avatar
9 votes
2 answers
2k views

Sudoku Solver in C without recursion

I am trying to learn backtracing , so i wrote program for Sudoku It solves sudoku in approx. 1 ms in online c compiler but this one sudoku puzzle is taking approx. 35 sec in that online c compiler ...
G.ONE's user avatar
  • 271
0 votes
1 answer
145 views

Speed up performance of backtracking solution for Sudoku solver

I can't improve the performance of the following Sudoku Solver backtracking solution. I know there are 3 loops here and they probably cause slow performance but I can't find a better/more efficient ...
profarvin's user avatar
0 votes
1 answer
217 views

Sudoku puzzle solver for Leetcode

I just solved a problem from leetcode that is faster than 28.42% of the PHP codes, so the main review target is not the performance or alternative ways to solve this problem. I wrote the code thinking ...
Chubby Cows's user avatar
2 votes
0 answers
38 views

Sudoku trial buttons

This button's code in gdscript 4 uses selector modes- only one possible at a time. It is attached to the 9 children small buttons of the main button. There is singleton code that is just an array with ...
user2617804's user avatar
2 votes
1 answer
860 views

Sudoku Tkinter generator

I made OOP sudoku generator - at this moment it generates only valid table. You can clear it and then generate over. The case is I struggled with calling "fill_board" and "clear_board&...
pan_martino's user avatar
1 vote
0 answers
86 views

How can I optimise my recursive backtracking sudoku algorithm?

I've tried optimising my program by removing invalid values for possible spaces instead of searching from 1-9, and by choosing values with the lowest number of empty spaces in its row and column, but ...
idkDude's user avatar
  • 11
6 votes
1 answer
174 views

Rust based Sudoku solver using backtracking

I've just started learning rust and have written a basic sudoku solver, however it seems to run much slower than I expected. So I'm looking for any possible performance improvements as well as any ...
theAlex's user avatar
  • 63
4 votes
0 answers
120 views

Sudoku sequence solver for non-standard constraints

This script is designed to help solve sequences in Sudoku puzzles with variant constraints (ex: Thermometer, Renban, etc.). Summary The user specifies the constraints they want applied as well as the ...
JS Lavertu's user avatar
4 votes
3 answers
901 views

Sudoku Solver and Generator in Python

I made a Sudoku Solver after following some tutorials. Then I made a Sudoku generator and everything works. I also used classes to make it look more organized. I wanted to know what I can do better to ...
Random_Pythoneer59's user avatar
9 votes
4 answers
3k views

Criticize my Sudoku solver for improvements (C# beginner)

I recently started programming and chose C# as my first language. After a couple of weeks/month now I tried to make my own Sudoku solver in a console application. I'm happy with the result, and tried ...
TesterPresent's user avatar
1 vote
1 answer
309 views

Validate Empty Sudoku: Multi-Threaded Solution

The problem is that we have an unsolved sudoku board, and we want to validate it, we need to check each column, row and sub-square. Here we represent a empty cell with -1. My idea was to create a ...
AKRA's user avatar
  • 155
6 votes
2 answers
498 views

Python backtracking algorithm to solve sudoku

I have recently gotten back into writing python and i decided to take up a project of writing a backtracking algorithm in python to solve Sudoku puzzles How it Works A matrix is declared to represent ...
HiddenSquid123's user avatar
1 vote
2 answers
250 views

Possible speed improvements for a Sudoku board validation algorithm?

I tested this algorithm on 9x9 boards and on average, if the board passed to the function is a (valid) solution, it takes 0.13-0.14 seconds for 1 million executions on my machine. I ran my code in ...
C4Oc's user avatar
  • 19
3 votes
2 answers
631 views

Sudoku Game with automatically generated Sudokus

Project I've created a puzzle site with automatically generated sudokus. For more information on Sudokus, please see the wikipedia article. The code ...
user avatar
11 votes
3 answers
1k views

Sudoku solver program written in modern c++

This is a simple program that solves a given Sudoku puzzle recursively. The input is provided as a file that contains the cells, 0 if empty, delimited by a , ...
adityagnet's user avatar
3 votes
1 answer
140 views

Sudoku Solver using rules of Sudoku and backtracking

This code tries to solve the sudoku board using the rules of sudoku. When it does not make progress in solving, it assumes a cell value and tries again. Please review my code and help me understand ...
Uban's user avatar
  • 103
2 votes
2 answers
976 views

Recursive Sudoku solver using Python

A Sudoku solver that works recursively. I'd appreciate your comments about coding style, structure and how to improve it. Thank you very much for your time. Code structure The Solver works by ...
fabrizzio_gz's user avatar
3 votes
0 answers
240 views

A valid Sudoku Generator without backtracking in JavaScript

I am new to programming. I tried to write a valid Sudoku solver with backtracking, the performance is disappointing. So, I tried to generate a valid Sudoku generator without backtracking. The white ...
Jason Rich Darmawan's user avatar
4 votes
1 answer
434 views

Generalised NxN Sudoku solver using heap

My implementation of a Sudoku solver. It isn't done using the most naive way but still it does an exhaustive search with some assistance from a heap. The only constraints I have used is the basic ...
srt1104's user avatar
  • 211
2 votes
1 answer
231 views

Python sudoku solver using backtrack algorithm

My first attempt at a sudoku solver using the backtrack algorithm. ...
AkThao's user avatar
  • 190
4 votes
1 answer
293 views

Sudoku solver using backtracting and depth-first-search

I've recently finished my first ever C program. I implemented a Sudoku solver that uses backtracking. Does my code look like a proper C-program? Are there any recommendations for improving my code? <...
Ivan Shelomentsev's user avatar
2 votes
1 answer
1k views

Made a sudoku solver with basic GUI in C++

I've made a sudoku solver which solves a sudoku, given user input, and can also extract digits from a picture of a sudoku to solve it. I've used OpenCV and GTK+ 2.0 to achieve the above. I am very ...
karan_zoh's user avatar
1 vote
1 answer
521 views

Sudoku-Solver with GUI - follow-up

Background A few months ago, I asked this and this question on my implementation of a Sudoku-Solver. I now tried to further improve this little project. Changes Minor GUI-changes Input validation "...
user avatar
10 votes
4 answers
8k views

Simple Sudoku Solver in Python

This is my naive approach on implementing a Sudoku solver, which is okay for simple Sudokus like this: ...
Leo oeL's user avatar
  • 103
2 votes
1 answer
517 views

JavaScript Sudoku Recursive Solver

Thanks for all the great feedback in Part 1. I implemented a lot of it. Here is version 2. I am looking for feedback on: Recursive solve algorithm. It's too slow. I used Chrome DevTools Performance ...
RedDragonWebDesign's user avatar
1 vote
0 answers
90 views

Sudoku seed generator

The code returns a string ready to seed at sites like sudoku-solutions.com. It works great but as I couldn't find other simple examples for my level I hope for some insights on this and ways to ...
Yamil Duba's user avatar
6 votes
3 answers
10k views

Sudoku game in JavaScript

PHP coder here. Learning JavaScript this week. I made a sudoku game for practice. Features: Import puzzles by pasting a text string. Imported squares are gray. Your squares are white. Program doesn't ...
RedDragonWebDesign's user avatar
3 votes
1 answer
461 views

C backtracking Sudoku solver

I wrote this program in C to solve a given Sudoku puzzle (represented as 2D array) using backtracking algorithm. How can I make it more efficient, maybe faster and more C-onic? This is my first post ...
Shechner's user avatar
3 votes
1 answer
2k views

Python sudoku solver with classes

I just coded an object-oriented Sudoku solver, but I don't have any possibility to check whether I have written good code, so I thought I would just post it here for review. I have looked for other ...
depletedboi's user avatar
1 vote
1 answer
263 views

Speeding up naive backtracking Sudoku Solver in Haskell

After watching a recent computerphile video on building a very simple sudoku solver I tried to implement the same in Haskell. From this CR question I learned that it is probably a better idea to use ...
flawr's user avatar
  • 261
2 votes
2 answers
152 views

"Smart" sudoku brute-forcer

After running my C-brute-forcer for two days on a 25x25 sudoku, I decided to re-write in Java so that it would solve it in an acceptable time frame. The idea: Make smart fields that contain all ...
mindoverflow's user avatar
12 votes
3 answers
3k views

Basic Sudoku Solver

For my programming class I had to make a sudoku solver. ...
user avatar
2 votes
2 answers
255 views

Python Sudoku Solver

I wrote this program for a Sudoku solver in Python. It utilizes tkinter GUI. I've uploaded the project to my GitHub. Please can you have a look and let me know of ...
MGedney's user avatar
  • 91
3 votes
1 answer
245 views

Sudoku-Solver - follow-up

I've now tried to use the suggestions you can find here to improve my Sudoku-Solver. Here's the updated code: ...
user avatar
4 votes
1 answer
2k views

Sudoku-Solver with GUI in Java

I've wrote a Sudoku-Solver in Java, which also contains a GUI, so you can just enter the Sudoku, press "OK" and it will solve the Sudoku using backtracking. Here's the code: ...
user avatar
5 votes
1 answer
330 views

Sudoku Board Generator

I am working on a Sudoku board generator that generators a valid complete Sudoku board. My algorithm generates a valid board, but the runtime is variable. Time varies from ~0.2 to 8 seconds. Ideally, ...
Snoop2001's user avatar
  • 137
7 votes
3 answers
2k views

Displaying a Sudoku Board

For my programming class, we have been tasked with creating a Sudoku solver; the first step of the project was to create a program which would display the game board based on input provided by the ...
user avatar
6 votes
2 answers
252 views

Validating sudoku columns and rows

I'm writing a sudoku col/row validator, what is does is: Reads user input on how many Sudoku instances to validate. Reads the sudoku matrix grid 9x9 (for me, in my specific case 9x9) into a 2d array. ...
Vinícius's user avatar
  • 227
1 vote
1 answer
178 views

Sudoku validation

Problem explanation I've written a function to validate sudoku. Given a two-dimensional 9×9 array of numbers: Each row should have each of the numbers 1–9 exactly once. Each column should have each ...
shreyasminocha's user avatar
2 votes
1 answer
653 views

Creating an empty Sudoku grid

I am generating a 9x9 grid on which I will play sudoku later by setting click listeners to each square on the grid. I first have a .xml file that represents a single square in the grid. This consists ...
Daniel Duque's user avatar
4 votes
2 answers
101 views

Solving Sudoku using computer vision, feedback on class

I have made a project at Github that uses computer vision to solve Sudokus. Since this is my first project I would really like to get some feedback on my code. Since it is not allowed to link my ...
Empan's user avatar
  • 73
4 votes
2 answers
1k views

Solving Sudoku with backtracking

I wrote a backtracking Sudoku solving algorithm in Python. It solves a 2D array like this (zero means "empty field"): ...
hardfork's user avatar
  • 227
3 votes
1 answer
2k views

LeetCode #37: Sudoku as Exact Cover Problem solved using Dancing Links

Introduction I provide a regular 9x9 Sudoku solver, reducing the puzzle to an Exact Cover Problem. The algorithm used is Knuth'...
dfhwze's user avatar
  • 13.9k
0 votes
1 answer
74 views

Python script takes input of four elements and outputs a valid 4 × 4 Sudoku grid in O(n) time, but only when given non-repeating elements

Introduction I've found a clever and fun thing to do after solving a n2 × n2 sudoku puzzle. I can take a grid as such as this one and hard-code its indices as constraints to output other 4 × 4 latin ...
The T's user avatar
  • 451
3 votes
2 answers
2k views

Easy-Medium Sudoku solver written in Python - No recursion/ brute force

I'm very new to software developing, I wrote this Sudoku solver in Python, it's not the best approach ever I know and that is I guess because I started taking courses in Python and programming a month ...
user avatar
5 votes
1 answer
188 views

Sodoku solver with arrays of bitsets

I wrote a quick sodoku solver as an exercise and am curious how to make it faster. Parsing and printing is largely irrelevant only there for readability. How can I make the code cleaner and faster? <...
Bomaz's user avatar
  • 297