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
0
votes
1answer
31 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 ...
3
votes
2answers
101 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 ...
5
votes
1answer
86 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? <...
3
votes
1answer
47 views

Partial Sudoku Verifier

To practice my JavaScript for future employment, I've decided to take up the challenge of writing a javascript sudoku verifier. This code only verify's one of the ...
0
votes
1answer
230 views

Generate n^2 x n^2 Sudoku in poly-time

Introduction I have created an algorithm that generates n! Sudoku Grids in poly-time.I verified the correctness of my grids with a SAT solver up to 50x50. I'm awaiting a review for improvements. It ...
2
votes
2answers
69 views

Sudoku generator using seed Sudoku

I have created a Sudoku generator in Java. Here I am using a basic solved sudoku as seed and by transposing it and shuffling its row and columns I get a new solved sudoku. ...
17
votes
2answers
3k views

Simple recursive Sudoku solver

My Sudoku solver is fast enough and good with small data (4*4 and 9*9 Sudoku). But with a 16*16 board it takes too long and doesn't solve 25*25 Sudoku at all. How can I improve my program in order to ...
4
votes
2answers
63 views

Three stage Sudoku puzzle generator

This was my first time attempting a project like this, so I figured it would improve readability, and would also just be nice If I allowed each stage to be visualized. Also, this only generates them, ...
1
vote
0answers
68 views

Java Android Sudoku solver

I made a simple and non recursive Android Java Sudoku solver implementing Algorithm X with links inspired from dancing links. The code is on Github (start with the Solver class and the ...
2
votes
1answer
176 views

Skyscraper puzzle solver in Java [closed]

For an assignment, I have created a solver for the Skyscraper Puzzle: Each puzzle consists of an N×N grid with some clues along its sides. The object is to place a skyscraper in each square, with a ...
2
votes
2answers
174 views

Valid Sudoku in Swift

This is my solution to LeetCode – Valid Sudoku in Swift. ...
3
votes
0answers
75 views

Amateur Python Sudoku Solver

I'm self-taught in Python and would have a lot of room for improvement. I made this basic Sudoku Solver mainly in order to practice the use of Class creation. I would greatly appreciate any feedback ...
3
votes
1answer
207 views

Object Oriented Sudoku Solver in Python

I started learning Python and I am preparing Sudoku Solver as my first small project. I am also trying to learn unit testing. I thought it is a good idea to ask for suggestions before I start with GUI....
2
votes
2answers
203 views

NxN Sudoku Solver

I have written a Sudoku solver which can solve arbitrary NxN grids via backtracking. Since I'm relativly new to C any feedback is welcome. Code: ...
7
votes
1answer
166 views

Sudoku-lite challenge

You can find the problem here. The example: Column A, B, and C are each 3 and together equal 9: ...
1
vote
0answers
509 views

Sudoku solver using NumPy

I come from the R language and I gradually switch to Python (Numpy and Pandas). I coded this python code for fun to solve a Sudoku grid. Could you tell me if my code is pythonic enough? For example, ...
7
votes
1answer
227 views

Fast and flexible Sudoku Solver in C++

After seeing a lot of Sudoku solvers on Code Review I decided to implement my own. My implementation aims to be very fast and flexible, supporting some Sudoku variations (irregular boxes, extra ...
6
votes
2answers
411 views

Enhance Sudoku puzzle generator

I wrote a Python script that generates a Sudoku puzzle. Everything works just fine but it takes too much time to generate puzzle from a completed board (remove_cells...
10
votes
2answers
412 views

C++ code for solving a sudoku using backtracking

I made a sudoku solver using backtracking in C++ and I would like to know what can I do to speed up my code. I am new to this language and I don't know all its special tricks yet! I was told to go to ...
6
votes
1answer
473 views

Constexpr unit tests and asserts

I'm trying out some different programming styles to experiment with the new C++ concepts. Within the experiment I was looking into how constexpr could be helpful ...
2
votes
2answers
1k views

Simple Sudoku Solver

i have made a simple sudoku solver which is a puzzle game where the player has to figure out the empty cell and checks which numbers are absent from the corresponding row, column. how can I improve ...
2
votes
3answers
2k views

Beginner's Sudoku solver in C

I'm beginner programmer and I've challenged myself to write sudoku solver in C. I have finished it in few days and now I want to make it faster. With this sample input execution time is 1.781 ...
4
votes
0answers
486 views

Mini sudoku (4x4) generator efficiency

I have a code that can generate a 4x4 sudoku matrix, by random generation of numbers. To do this, i create a Matrix4 class that can detect its elements by its rows, ...
5
votes
1answer
209 views

Simple Sudoku solver in Rust

This is my little Sudoku solver in Rust. It iterates through empty cells and checks which numbers are absent from the corresponding row, column, and square. If there is one possible candidate, it ...
1
vote
0answers
79 views

Ruby Sudoku Solver without classes

I'm writing a Sudoku solver in Ruby to complete a coding challenge with the following restrictions. Failing to follow the following restrictions will result in an invalid submission: Do ...
6
votes
1answer
1k views

C++ Sudoku Solver

I just finished up a sudoku solver in C++. I originally completed a solver in Python for coursework and I wanted to see how much of a performance gain I could get. Because of this, I ended up using ...
22
votes
4answers
5k views

Sudoku Solver in Python

I wrote this sudoku solver in Python. This is my first substantial project, and I would love any comments or feedback. ...
9
votes
5answers
4k views

Sudoku verifier in Java

This program verifies if a matrix is a Sudoku or not. These conditions should be verified: There are no duplicates in a row, column, or square The sum of a row, column, or square should be equal to ...
4
votes
1answer
2k views

Sudoku solver recursive solution with clear structure

Problem statement Similar to Leetcode 37 Sudoku solver, the algorithm is to determine if the sudoku board can be filled with ‘1’,‘2’,…,‘9’. A sudoku board is represented as a two-dimensional 9x9 ...
5
votes
1answer
632 views

Sudoku puzzle solving algorithm that uses a rule-based approach to narrow the depth search

I had written a Sudoku puzzle solver that accepts 9x9 puzzle boards, and completes them with the least possible time. Rather than purely depending on brute-force, ...
3
votes
1answer
254 views

Sudoku Solver To SAT implementation

I implemented an algorithm for solving sudoku using reduction from sudoku to SAT. Now, I am trying to refactor the code using code review principles. I find some difficulties apply the principles....
6
votes
1answer
346 views

Recursive Depth First Search for finding valid sudoku boards in Python 3

I am not an experienced programmer, and I decided to make a program that could find all possible sudoku arrangements just for fun. As far as I can see, the program is working all right, but I'd like ...
4
votes
3answers
630 views

Verifying and reducing Latin squares with Python 3

Similar to my previous post, I'm completing this challenge, which is to verify whether an n × n grid is a Latin square. I have also solved the bonus problem, which is to rearrange a valid Latin square ...
1
vote
2answers
370 views

Sudoku solver iterating too much

I need help reducing the number of iterations my current implementation takes to solve the puzzle. I've got a pre-built class I am attempting to implement, albeit I think my backtracking needs ...
1
vote
1answer
2k views

Check if a given grid is a valid Sudoku

At CodeFights I found a question about the validity of Sudoku grid. Given a grid, return true if it is valid, return false otherwise. The grid is valid when each row, each column and each 3x3 sub grid ...
2
votes
0answers
201 views

Scala Performance in Solving Sudoku

I translated Peter Norvig Python Sudoku solver to Scala and my Scala implementation was slower in the order of few magnitudes e.g. instantaneous, in Python, vs 4 to 5 seconds. I suspected I didn't ...
3
votes
3answers
255 views

Haskell Sudoku Solver

Any comments on the following Sudoku solver? Comments I'm particularly interested are (but not limited to...) Algorithm. It created a list of "potentials" for each cell, and trims them down until it'...
4
votes
1answer
1k views

Validate if Sudoku is correct

Given a two-dimensional array, Sudoku class can create NxN Sudoku where N = size^2. Assume that the user gives only valid NxN matrixes for the constructor. Method <...
3
votes
1answer
200 views

Sudoku solver using backtracking, in Ruby

I wrote the below Sudoku solver, using Backtracking. Would love to hear your comments on the approach, and how I can improve readability/performance: ...
7
votes
1answer
437 views

A DFS sudoku solver

This is my attempt at a Sudoku solver using a DFS approach. I mainly developed it to become a better Rust developer, but if you have any performance tips, I will be glad to hear them :) My program ...
3
votes
0answers
168 views

Sudoku solver in Haskell using Reader+ST

While trying to understand monad transformers in Haskell I came up with a sudoku solver based on a combination of the ST and Reader monad. I am positively surprised with the performance, however ...
3
votes
1answer
130 views

Ruby sudoku solver using backtracking (interview)

I was required to implement the code to a spec file I was provided in Ruby. I was rejected with the message "The quality of your code isn't sufficient for this position". Can you please tell me what ...
7
votes
2answers
437 views

OOP Sudoku solver with minimal guessing

Having only had experience with programming in Matlab I started this project to learn a real programing language, object-oriented programming and a proper coding style. I wanted to implement a ...
4
votes
2answers
163 views

Implementation of a Sudoku Solver

I know it may be fairly bad. I want to find out exactly how horrendous it is and any suggestions on how to improve are appreciated. ...
8
votes
2answers
2k views

Sudoku solver recursive solution

Here is my code in Python 2.7 for a Sudoku resolver. Any advice on performance improvement, code bugs or general code style advice is appreciated. My major idea is: Using method generate some random ...
6
votes
1answer
1k views

Sudoku solver with Tkinter

The code below is a Sudoku solver using backtracking. There is a fast mode which doesn't display the permutations in the Tk widget in real time; only the solved grid. This is the second version of a ...
2
votes
2answers
910 views

Sudoku solver in Racket

I have written following code to solve Sudoku puzzles in Racket (a Scheme/Lisp derivative programming language). Following relatively simple code appears to work but are there any bugs in it or can it ...
3
votes
0answers
186 views

Solving Sudokus in Scheme Using Simulated Annealing

This program's purpose is to solve sudokus using simulated annealing. It first fills all the 3x3 blocks in the sudoku such that every block is filled with 1-9. It also builds a list of pairs of ...
4
votes
1answer
514 views

Multithreaded Python implementation of a Sudoku validator

I've just come across these day with the multithreading subject in Python. I remembered @200_success's answer and I thought of making that multithreaded as it follows: one thread to check that each ...
2
votes
1answer
3k views

Sudoku grid validator

I have coded a sudoku grid validator as a problem set from an online course. My input to the validator is a list of lists, that represents a sudoku grid. For reference, below are examples of an ill-...