Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Ruby (http://www.velocityreviews.com/forums/f66-ruby.html)
-   -   Looking for a Sudoku Algorithm to implement in Ruby (http://www.velocityreviews.com/forums/t845629-looking-for-a-sudoku-algorithm-to-implement-in-ruby.html)

Victor Reyes 11-10-2007 04:50 PM

Looking for a Sudoku Algorithm to implement in Ruby
 
Note: parts of this message were removed by the gateway to make it a legal Usenet post.

Hey,

Did anyone know of a Sudoku algorithm, which I can use to implement a Ruby
solution?
Although I can solve Sudoku without much difficulty, I can't say the same
when I try to write a Ruby program to solve Soduku.

Thanks,

Victor


Andreas Launila 11-10-2007 05:37 PM

Re: Looking for a Sudoku Algorithm to implement in Ruby
 
Victor Reyes wrote:
> Did anyone know of a Sudoku algorithm, which I can use to implement a Ruby
> solution?


You might want to have a look at Ruby Quiz #43 (Sudoku Solver):
http://www.rubyquiz.com/quiz43.html

Alternatively you could also solve it using constraint programming with
Gecode/R: http://gecoder.rubyforge.org/examples/sudoku.html

--
Andreas Launila


Hariharasudhan R 11-10-2007 06:18 PM

Re: Looking for a Sudoku Algorithm to implement in Ruby
 
Hi..

The following projects on codeproject may give you some ideas..

http://www.codeproject.com/csharp/sudoku.asp
http://www.codeproject.com/useritems/sudoku_solver.asp
http://www.codeproject.com/useritems/sudoku.asp
http://www.codeproject.com/miscctrl/XSudokuWnd.asp

Thanks,
Hari

PS : This is my first post. Sorry if I should not post links to other
language articles. just wanted to help..


On Nov 10, 2007 10:20 PM, Victor Reyes <victor.reyes@gmail.com> wrote:
> Hey,
>
> Did anyone know of a Sudoku algorithm, which I can use to implement a Ruby
> solution?
> Although I can solve Sudoku without much difficulty, I can't say the same
> when I try to write a Ruby program to solve Soduku.
>
> Thanks,
>
> Victor
>



kevin cline 11-10-2007 09:11 PM

Re: Looking for a Sudoku Algorithm to implement in Ruby
 
On Nov 10, 10:50 am, Victor Reyes <victor.re...@gmail.com> wrote:
> Hey,
>
> Did anyone know of a Sudoku algorithm, which I can use to implement a Ruby
> solution?


The Soduku puzzle can be solved in a few seconds by a very simple
backtracking algorithm:

current_cell = first_empty_cell

while true
if put_next_possible_number_in_current_cell
if all_cells_filled
print_solution
exit
else
current_cell = next_empty_cell
end
else if current_cell = first_empty_cell
raise Exception.new("no solution")
else
current_cell = previous_empty_cell
end


Victor Reyes 11-10-2007 09:44 PM

Re: Looking for a Sudoku Algorithm to implement in Ruby
 
Note: parts of this message were removed by the gateway to make it a legal Usenet post.

Thanks to everyone for your suggestions and recommendations.
I truly appreciate all your input.

Thanks again,

Victor

On 11/10/07, Andreas Launila <ruby-talk@lokorin.org> wrote:
>
> Victor Reyes wrote:
> > Did anyone know of a Sudoku algorithm, which I can use to implement a

> Ruby
> > solution?

>
> You might want to have a look at Ruby Quiz #43 (Sudoku Solver):
> http://www.rubyquiz.com/quiz43.html
>
> Alternatively you could also solve it using constraint programming with
> Gecode/R: http://gecoder.rubyforge.org/examples/sudoku.html
>
> --
> Andreas Launila
>
>



Jimmy Kofler 05-12-2008 09:27 AM

Re: Looking for a Sudoku Algorithm to implement in Ruby
 
> Looking for a Sudoku Algorithm to implement in Ruby
> Posted by Victor Reyes (Guest) on 10.11.2007 17:51
> Hey,
>
>Did anyone know of a Sudoku algorithm, which I can use to implement a Ruby solution?
> . . .


Here's yet another one:

Sudoku solver in Ruby using SAT (Boolean satisfiability problem)

http://eli.thegreenplace.net/programs-and-code/

Cheers,

j.k.
--
Posted via http://www.ruby-forum.com/.



All times are GMT. The time now is 01:02 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57