Slash Boxes

SoylentNews is people

SoylentNews is powered by your submissions, so send in your scoop. Only 18 submissions in the queue.
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) by Nerdfest on Wednesday July 02 2014, @12:42PM

    by Nerdfest (80) on Wednesday July 02 2014, @12:42PM (#63002)

    I had a look at the source code for a few. This is obviously some meaning of the word "elegant" I wasn't previously aware of. They're reasonable clean and well formatted solutions, but I'd be very hard-pressed to call them elegant. In general, I don't think purely procedural languages are not made for 'elegant' solution. Fast? Sure. Straight-forward? If well written, yes, but they generally end up being longer than more 'elegant' solutions in object oriented or functional languages. That's not to say those approaches are necessarily better. If you're not careful, elegant can drop off the cliff to obscure.

    Starting Score:    1  point
    Karma-Bonus Modifier   +1  

    Total Score:   2  
  • (Score: 2, Funny) by middlemen on Wednesday July 02 2014, @01:35PM

    by middlemen (504) on Wednesday July 02 2014, @01:35PM (#63040) Homepage

    The summary means "elegant FORTRAN" not "any" elegant code in general. FORTRAN code can look really ugly and like Python needs a lot of formatting !

    The most elegant code to solve Sudoku in my fictional language titled "sudokoo" is as below:

    solve sudoku || sudo solve sudoku

    • (Score: 2, Interesting) by Anonymous Coward on Wednesday July 02 2014, @01:41PM

      by Anonymous Coward on Wednesday July 02 2014, @01:41PM (#63043)

      Yeah except it's written in F90 so it doesn't need fixed-form formatting at all, and it isn't written FORTRAN but Fortran. The formatting requirements for "modern" Fortran -- and it's stretching it a bit to describe a 15 year old standard as modern -- are barely more stringent than those for C or C++. One can write perfectly elegant programs in F90 and beyond, so long as one's view of "elegance" doesn't rule out "end if" and "end do" statements.