|
![]() |
Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming | |
Sudoku solver, brute force, where to start?
|
||
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) | ||||||||||||
|
Overclocker
![]() |
I've written a sudoku solver in python that used logic methods to solve most, but not all, puzzles. I'm looking to write a guessSolution function to finish off puzzles that the logic methods could not completely solve, but not sure where to start, as I've never written a brute force algorithm before.
__________________If anyone has wrote a brute force solver, how did your functions go about solving the puzzle?
|
||||||||||||
|
|
|
|
|
#2 (permalink) | ||||||||||||||
|
WaterCooler
![]()
Join Date: Dec 2008
Location: Dripping Springs/Denton
Posts: 1,230
Rep: 73
![]() Unique Rep: 62
Trader Rating: 4
|
i had to write one for a course last semester. I'm not familiar with python, but for java, I had the sudoku be a 2d array with 0s as the blanks and generated 3 random numbers- x-coordinate, y-coordinate, and value and used the 3 numbers accordingly. And if it was legal, push the 2d array onto a stack. Then keep going.
It takes forEVER. You may wanna toss in some solving algorithms after guessing some numbers to try and speed it up
__________________
I'm a junior in college, Comp Sci major/math minor, if you wanna talk, send me a pm ![]() The *OFFICIAL* HAF 932 Case Owners Club My HAF 932 Paint Job My WC Loop![]() Quote:
|
||||||||||||||
|
|
|
|
|
#3 (permalink) | ||||||||||||
|
Overclocker
![]() |
Thanks for the reply.
__________________I've just spent the last 10 mins working out how to do it. When I start guessing, I know what the unsolved cells are, and the remaining values each cell can take, which should greatly speed up the guessing process. Hopefully, it will be as easy to code as it was to write.
|
||||||||||||
|
|
|
|
|
#4 (permalink) | |||||||||||||||
|
WaterCooler
![]()
Join Date: Dec 2008
Location: Dripping Springs/Denton
Posts: 1,230
Rep: 73
![]() Unique Rep: 62
Trader Rating: 4
|
Quote:
__________________
I'm a junior in college, Comp Sci major/math minor, if you wanna talk, send me a pm ![]() The *OFFICIAL* HAF 932 Case Owners Club My HAF 932 Paint Job My WC Loop![]() Quote:
|
|||||||||||||||
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|