Slash Boxes

SoylentNews is people

posted by LaminatorX on Wednesday July 02 2014, @12:34PM   Printer-friendly
from the Which-Door-would-He-Suggest? dept.

Computational nanoscientist Surendra Jain has written solvers for Sudoku, Killer Sudoku, Samurai Sudoku, Calcudoku, Kakuro and many other logic problems.

All are elegantly coded and very fast: for example, the "World's Hardest Sudoku" is solved in 0.05 seconds (on a 5 year old PC) and his Knight's Tour solver is an order of magnitude faster than this one.

The page (called "Classical Geek") has all source (in Fortran 90, one of the most popular languages in high-performance computing) as well as compilation and running instructions.

This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 2, Informative) by Anonymous Coward on Wednesday July 02 2014, @04:04PM

    by Anonymous Coward on Wednesday July 02 2014, @04:04PM (#63117)

    The algorithm is simply:

    1. Go to next empty cell. If no empty cell, puzzle is solved, exit

    2. For each possible value for that cell (such that there are no row/column/box conflicts), assign that value and return to #1. If no solution was recursively reached, make cell empty again.

    It works, but it's just one step above pure brute force. Not novel in any way.

    Not only that, but the way he's implemented it is really efficient. I could easily reduce it to half the lines of code.

    And its barely even readable code. He declares variables such as "i", "ii", "iii", "iiii", "ith", "j", "jj", "jjj", "jth"... And some of the variables he declares and assigns aren't even used.

    This is something a freshman computer science student would turn in for homework and get a 'B' on. NOT news material.

    Starting Score:    0  points
    Moderation   +2  
       Interesting=1, Informative=1, Total=2
    Extra 'Informative' Modifier   0  

    Total Score:   2  
  • (Score: 2) by TGV on Thursday July 03 2014, @05:26AM

    by TGV (2838) on Thursday July 03 2014, @05:26AM (#63410)

    I thought you were joking, but no, the Sudoku_solver is precisely as you describe. It's awful. The other variable names in the core routine are small_cell_row,small_cell_column, value1,value2,value3,value_cells1,value_cells2,value_cells3. That's unreadable.

    I think said freshman should be glad with a C.