sudoku

Random sudoku generation

I'm writing a function that should generate random sudoku puzzles for a simulation project; this funcion takes as argoument the number of cells to generate then it generates the indexes of cells and numbers to put in those cells. I have a problem in generation of cells indexes, I'm not an expert in programming and i can't find a good ro...

help on sudoku solving

Can someone please help me understand this solution http://en.wikipedia.org/wiki/Algorithmics_of_Sudoku#Example_of_a_brute_force_Sudoku_solver_.28in_C.29 ...

functions not working the way they should in sudoku solver?

I'm trying to make a 4x4 sudoku solver in Python (I'm only a beginner!) and while trying to define a function to clean up my code somewhat, I ran across some strange behavior I don't really understand. Apparently, there's a difference between this: sudoku = "0200140000230040" sudoku = map(lambda x: '1234' if x=='0' else x, list(sudoku)...

Need to skip newline char (\n) from input file

I am reading in a file into an array. It is reading each char, the problem arises in that it also reads a newline in the text file. This is a sudoku board, here is my code for reading in the char: bool loadBoard(Square board[BOARD_SIZE][BOARD_SIZE]) { ifstream ins; if(openFile(ins)){ char c; while(!ins.eof()){ for ...

zChaff not showing output

Hello, So I downloaded the latest version of zChaff (2007), and was trying out some very simple SAT problems. But zChaff does not output the solution (variable assignments). A very simple example input: p cnf 2 2 1 2 0 1 -2 0 And what I get: c 2 Clauses are true, Verify Solution successful. Instance Satisfiable 1 -2 Random Seed Used...

Comparing all values within a List against each other

I am a bit stuck here and can't think further. public struct CandidateDetail { public int CellX { get; set; } public int CellY { get; set; } public int CellId { get; set; } } var dic = new Dictionary<int, List<CandidateDetail>>(); How can I compare each CandidateDetail item against other Ca...

How to re-use a thread in Java ?

I am a building a console Sudoku Solver where the main objective is raw speed. I now have a ManagerThread that starts WorkerThreads to compute the neibhbors of each cell. So one WorkerThread is started for each cell right now. How can I re-use an existing thread that has completed its work? The Thread Pool Pattern seems to be the solut...

Solving Naked Triples in Sudoku

Hello, I wished I paid more attention to the math classes back in Uni. :) How do I implement this math formula for naked triples? Naked Triples Take three cells C = {c1, c2, c3} that share a unit U. Take three numbers N = {n1, n2, n3}. If each cell in C has as its candidates ci ⊆ N then we can remove all ni ∈ N from the other cells in...

Creating sudoku initial boards

Is there an algorithm or way I can get initial state sudoku puzzles for a sudoku game. Preferably with the ability to have different levels of difficulty? ...

Brute-force sudoku solver: backtracking?

An implementation of a brute-force algorithm to solve Sudoku puzzles fails if a cell is discovered in which placing any of the digits 1-9 would be an illegal move. The implementation is written in C, with the board represented by a 9x9 array. The solver counts down from 9 until a legal number's reached, and if none can be reached, it ou...

Problem porting sudoku solver from C to Python

I recently wrote a sudoku solver in C to practice programming. After completing it I decided to write an equivalent program in Python for a comparison between the languages and more practice and this is where the problem is. It seems to be that a global variable (sudokupossibilities[][][]) I declared outside the while loop isn't availabl...

UIKit controls for a sudoku grid?

I've recently completed an algorithmic sudoku solver in C, one in which three different approaches are taken to solve the puzzle. It was a piece of code I wrote for a Project Euler solution. Quite a bit of fun, I might add... Anywho, so I'm really interested in getting this little solver into an iPhone app. I really am at a loss for wha...

Building an EFFICIENT Sudoku Solver.

Hey everyone, Yes, I know this is nothing new and there are many questions already out there (it even has its own tag), but I'd like to create a Sudoku Solver in Java solely for the purpose of training myself to write code that is more efficient. Probably the easiest way to do this in a program is have a ton of for loops parse through ...

Arithmetic operation so that 0, 1, & 2 return 0 | 3, 4, & 5 return 1, etc.

Hello SO community! I'm trying to take 9x9, 12x12, 15x15, etc. arrays and have the program interpret them as multiple 3x3 squares. For example: 0 0 1 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 6 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 5 0 0 0 0 0 0 0 0 0 0 0 0 0 7 0 0 0 0 0 0 0 0 0 0 0 8 0 0 0 9 Will be understood as: 0 0 ...

Building a GUI for a Sudoku Solver (Complete with ASCII Example)

. OVERVIEW, SAMPLE Hello everyone, I have created a basic Sudoku solver that can solve most problems fairly quickly. I still have a lot of work ahead of me to make it solve even the hardest problems, but I'd like to try to implement a basic JFrame GUI first. I have worked with internet applets in the past, but never before with JFram...

Where to get Sudoku generator in C++ ?

Here is one - http://ostermiller.org/qqwing/ But sometimes my PHP code (shell_exec('qqwing..')) dies and in syslog I can find segfault errors for qqwing. So, I'm searching for better generator, but can't find one. Fast and with difficulty levels. Any suggestions? ...

How to make a Sudoku iPhone game?

I'm asking a lot of questions and this time I would like to know how to make a Sudoko game for the iPhone, is there anyone with experience from this? Can you help me out? David (newbie with lots of questions) ...

Brute force Algorithm for creation of Sudoku Board

What I am developing is that initially the entire sudoku board is empty. One of the random cells(out of 81) is filled with a random value(1-9). Now I want to fill all the remaining cells using brute force approach. From what I came to know after googling is that we should start with the first cell and fill it with 1(if it's valid), th...

[SOLVED] Sudoku solver keeps getting stuck for some reason...

So I had to write a program for a computer project for high school and I thought of doing a sudoko solver. The 'solve' algorithm is implemented like this:- For any points where only one element 'fits' looking at rows, columns, 3x3 set, put that number in. Do this repeatedly till it can't be done anymore. This is seen in the 'singleLeft...

identify programming language

Please identify this programming language: *Main> [ ((a,b,c),(d,e)) | a <- [1..7], b <- [2..8], c <- [3..9], d <- [1..8], e <- [2..9], a < b, b < c, d < e, List.intersect [d,e] [a,b,c] == [], a+b+c == 23, d+e == 10 ] output: [((6,8,9),(3,7))] I found the code in this blog comm...