![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Feb 2008
Posts: 2
Rep Power: 0
![]() |
Sudoku Problem
hi i am currently working on a sudoku solver which is a basic brute force method, i will post my code but i think where im having trouble is the 3x3 box checking function which is called BadBox() i have got this code working on a 4x4 grid and just cant seem to get it right with a 9x9 any help on this function would be greatly appreciated
c++ Syntax (Toggle Plain Text)
it should return the good solution as being good and the bad as bad, but it always returns the good as bad please help :s sorry most of the comments are from my 4x4 version but they should still be of some help. so at the moment it doesnt actually solve the sudoku for you, it is simply trying out wether or not it recognises when the puzzle is solved or not and as you see the good grid i have is definetley a valid sudoku. once this is working i can get onto the rest of my code |
|
|
|
|
|
#2 |
|
Expert Programmer
Join Date: May 2005
Location: East Lansing, MI
Posts: 663
Rep Power: 4
![]() |
Re: Sudoku Problem
First let me say that this is not the best way to implement a full 81 square sudoku, it's not even a good one. However, if you're a beginner programmer then you're excused. Let's get to business, you were right about BadBox(). It was not calculating the topleft correctly and wasn't bumping up the counter correctly either. A row/column approach would've made this program a lot simpler, but since you decided otherwise, I recoded your BadBox() function consistently with your current code.
C++ Syntax (Toggle Plain Text)
|
|
|
|
|
|
#3 |
|
Newbie
Join Date: Feb 2008
Posts: 2
Rep Power: 0
![]() |
Re: Sudoku Problem
thanks thats really helpful, and well commented thanks, i had a method like this but had trouble implementing it so thanks a lot
![]() |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Challenging Programming Problem - "Pinball Ranking" | Sane | Coder's Corner Lounge | 38 | Jan 15th, 2008 5:16 PM |
| Problem solving | ReggaetonKing | Software Design and Algorithms | 7 | Jan 4th, 2008 1:49 PM |
| Sudoku Solver code is making my head explode | FoSheezy | C | 1 | Nov 1st, 2007 6:20 PM |
| Sudoku program info & description | Adak | Software Design and Algorithms | 4 | Jul 2nd, 2006 12:49 PM |
| cgi/perl script + IE problem | joyceshee | Perl | 2 | Jan 24th, 2006 11:10 AM |