Looking for a Sudoku Algorithm to implement in Ruby

Discussion in 'Ruby' started by Victor Reyes, Nov 10, 2007.

  1. Victor Reyes

    Victor Reyes Guest

    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
    Victor Reyes, Nov 10, 2007
    #1
    1. Advertising

  2. Andreas Launila, Nov 10, 2007
    #2
    1. Advertising

  3. 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 <> 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
    >
    Hariharasudhan R, Nov 10, 2007
    #3
  4. Victor Reyes

    kevin cline Guest

    On Nov 10, 10:50 am, Victor Reyes <> 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
    kevin cline, Nov 10, 2007
    #4
  5. Victor Reyes

    Victor Reyes Guest

    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 <> 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
    >
    >
    Victor Reyes, Nov 10, 2007
    #5
  6. Victor Reyes

    Jimmy Kofler Guest

    > 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/.
    Jimmy Kofler, May 12, 2008
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    1,010
    Oliver Wong
    Apr 26, 2006
  2. dorayme

    The Guardian's website Sudoku

    dorayme, May 31, 2006, in forum: HTML
    Replies:
    12
    Views:
    828
    Jim Higson
    Jun 4, 2006
  3. Replies:
    5
    Views:
    424
    Nigel Greenwood
    Jun 22, 2005
  4. Bas

    Brute force sudoku cracker

    Bas, Sep 16, 2005, in forum: Python
    Replies:
    21
    Views:
    3,194
    Dennis Lee Bieber
    Sep 23, 2005
  5. jwesley
    Replies:
    1
    Views:
    169
    jwesley
    Feb 2, 2006
Loading...

Share This Page