Sudoku Solver
I am writing a program to solve Sudoku Puzzles.
This thread will contatin my progress throughout the project and hold any questions and replies.
Doogledude123
45
Posting Whiz
Recommended Answers
Jump to PostJust because Soduku is displayed in a 2D grid that doesn't mean you have to store it internally like that. And there are very good reasons why you shoudn't.
You have 81 cells. You want to look at groups of cells like {1,2,3,4,5,6,7,8,9} - a "horizontal row", or {1,10,19...} - …
Jump to PostallRCBs lists the cells that are part of each row/col/block. The members of the arrays are cell numbers.
The cells array holds the actual numbers 1-9 (or "empty").To understand why, just compare the incomplete code in your part 2 with the code in my last post. All I need …
Jump to PostHow you represent your board really depends on how you're planning to solve it. A good way to decide how you should save the board is to decide which operations you'll be performing on the board, and then deciding on how you want to store it.
A 9x9 array will …
Jump to PostTo check if a bunch of integers are unique, you can store them in a counting array, ie, for 0 < n < 10, count[board[n][row]]++, and check to see that all the values in count are 1. This works in O(n) time.
Jump to PostI wonder if I didn't explain my original proposal very well because it imposes zero overhead on changing cell values. At the risk of boring everybody (stop reading here if you like!) I'll go through it with greater care:
The game requires us to store 81 numbers, grouped in 27 …
All 19 Replies
Doogledude123
45
Posting Whiz
Doogledude123
45
Posting Whiz
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
peter_budo
commented:
Well put
+15
Doogledude123
45
Posting Whiz
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
Hiroshe
499
Posting Whiz in Training
Hiroshe
499
Posting Whiz in Training
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
Hiroshe
499
Posting Whiz in Training
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
Hiroshe
499
Posting Whiz in Training
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
Doogledude123
45
Posting Whiz
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
Doogledude123
45
Posting Whiz
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
Doogledude123
45
Posting Whiz
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.