Welcome, Guest. Please login or register.

Author Topic: Sudominator 0.1 for MorphOS  (Read 5976 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline krashanTopic starter

  • Sr. Member
  • ****
  • Join Date: Jan 2003
  • Posts: 253
  • Country: pl
  • Thanked: 1 times
  • Gender: Male
  • Hardware designer and programmer
    • Show all replies
    • Personal homepage
Sudominator 0.1 for MorphOS
« on: September 01, 2010, 09:18:10 AM »
Sudominator is a fast sudoku puzzle solver. It has a comfortable MUI based graphical interface. Thanks to optimized brute-force algorithm it solves any resolvable sudoku in a fraction of second, even on slow machines. The second, "live solve" mode allows for watching how the program solves the puzzle (every step is displayed at a rate of 50 steps per second). The program is distributed with the source code and can be downloaded from MorphOS Files.

Offline krashanTopic starter

  • Sr. Member
  • ****
  • Join Date: Jan 2003
  • Posts: 253
  • Country: pl
  • Thanked: 1 times
  • Gender: Male
  • Hardware designer and programmer
    • Show all replies
    • Personal homepage
Re: Sudominator 0.1 for MorphOS
« Reply #1 on: September 01, 2010, 11:08:03 AM »
This program has been written to show some person that solving sudoku manually is just waste of time. It also has been written just for the fun of programming of course :-). Once I've written the algorithm (running in shell) I've decided that wrapping it with some nice GUI may be fun. And it was indeed :-).

Offline krashanTopic starter

  • Sr. Member
  • ****
  • Join Date: Jan 2003
  • Posts: 253
  • Country: pl
  • Thanked: 1 times
  • Gender: Male
  • Hardware designer and programmer
    • Show all replies
    • Personal homepage
Re: Sudominator 0.1 for MorphOS
« Reply #2 on: September 01, 2010, 01:26:11 PM »
Quote from: JJ;577070
The sort of thing thats easier to work out with pen and paper than it would writing a tight algorithim to do it.


I've implemented the first version (shell based, sudoku initial state had to be entered in the code before compilation) in 30 minutes. I guess solving an usual sudoku with pencil and paper takes similar amount of time. But look, instead of solving one, I've solved all 6 670 903 752 021 072 936 960 possible in one go! ;-)

Offline krashanTopic starter

  • Sr. Member
  • ****
  • Join Date: Jan 2003
  • Posts: 253
  • Country: pl
  • Thanked: 1 times
  • Gender: Male
  • Hardware designer and programmer
    • Show all replies
    • Personal homepage
Re: Sudominator 0.1 for MorphOS
« Reply #3 on: September 01, 2010, 04:38:16 PM »
Quote from: JJ;577082
Do you have to do any research or did you just work it all out yourself.


I've designed the algorithm myself, since it is rather obvious. The algorithm is based on recursion and is a brute-force one. It means it checks all possibilities until it finds a solution. The thing starts from finding an empty field, which is most constrained by already entered numbers. Then the program tries to enter numbers from 1 to 9 into the field and checks if resulting partial solution is valid. If it is not, the algorithm steps back. If it is, the routine calls itself recursively, taking the next most constrained field.

The algorithm either finds that there are no more empty fields (which means the sudoku is solved), or steps back to its root call (which means the starting position is unresolvable).

I've found this algorithm to be very fast. Testing different sudoku, I've found that no more than 50 000 steps are needed usually. Even my poor Efika @ 400 MHz needs less than 100 miliseconds to do it.

Offline krashanTopic starter

  • Sr. Member
  • ****
  • Join Date: Jan 2003
  • Posts: 253
  • Country: pl
  • Thanked: 1 times
  • Gender: Male
  • Hardware designer and programmer
    • Show all replies
    • Personal homepage
Re: Sudominator 0.1 for MorphOS
« Reply #4 on: September 02, 2010, 01:22:58 PM »
Quote from: Linde;577305
Cool! The next step should be a solvable puzzle generator of varying difficulty :)


It requires some strict definition of sudoku difficulty first...

Offline krashanTopic starter

  • Sr. Member
  • ****
  • Join Date: Jan 2003
  • Posts: 253
  • Country: pl
  • Thanked: 1 times
  • Gender: Male
  • Hardware designer and programmer
    • Show all replies
    • Personal homepage
Re: Sudominator 0.1 for MorphOS
« Reply #5 on: September 02, 2010, 05:02:07 PM »
Quote from: JJ;577321
Wouldnt it relate to how many numbers are given to start?


It is related, but not linearly. Sudoku with very few numbers are easier, as they have very high number of solutions. Adding more numbers will make them harder. Minimal quantity of numbers giving an unique solution is estimated to be between 17 and 19, probably these are the hardest to solve. Adding more numbers will make them easier again.