Welcome, Guest. Please login or register.

Author Topic: Sudominator 0.1 for MorphOS  (Read 5967 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 only replies by krashan
    • 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 hooligan

  • Hero Member
  • *****
  • Join Date: Sep 2006
  • Posts: 515
    • Show only replies by hooligan
    • http://www.mikseri.net/hooligan
Re: Sudominator 0.1 for MorphOS
« Reply #1 on: September 01, 2010, 10:49:42 AM »
Sudoku solver... a bit like cheating in Solitaire, isn't it? :lol:
 

Offline krashanTopic starter

  • Sr. Member
  • ****
  • Join Date: Jan 2003
  • Posts: 253
  • Country: pl
  • Thanked: 1 times
  • Gender: Male
  • Hardware designer and programmer
    • Show only replies by krashan
    • Personal homepage
Re: Sudominator 0.1 for MorphOS
« Reply #2 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 jj

  • Lifetime Member
  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 4052
  • Country: wales
  • Thanked: 2 times
  • Gender: Male
    • Show only replies by jj
Re: Sudominator 0.1 for MorphOS
« Reply #3 on: September 01, 2010, 01:12:33 PM »
Well done .  I wouldn;t like to get my head around generating an program to work out sudoko.  The sort of thing thats easier to work out with pen and paper than it would writing a tight algorithim to do it.
 
Could probably do it, but would take me ages and probably be super slow
“We don't stop playing because we grow old; we grow old because we stop playing.” - George Bernard Shaw

Xbox Live: S0ulA55a551n2
 
Registered MorphsOS 3.13 user on Powerbook G4 15"
 

Offline krashanTopic starter

  • Sr. Member
  • ****
  • Join Date: Jan 2003
  • Posts: 253
  • Country: pl
  • Thanked: 1 times
  • Gender: Male
  • Hardware designer and programmer
    • Show only replies by krashan
    • Personal homepage
Re: Sudominator 0.1 for MorphOS
« Reply #4 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 jj

  • Lifetime Member
  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 4052
  • Country: wales
  • Thanked: 2 times
  • Gender: Male
    • Show only replies by jj
Re: Sudominator 0.1 for MorphOS
« Reply #5 on: September 01, 2010, 02:37:39 PM »
I am impressed.  I was saying I have not got the mathematical know how to do this.
 
Do you have to do any research or did you just work it all out yourself.
“We don't stop playing because we grow old; we grow old because we stop playing.” - George Bernard Shaw

Xbox Live: S0ulA55a551n2
 
Registered MorphsOS 3.13 user on Powerbook G4 15"
 

Offline krashanTopic starter

  • Sr. Member
  • ****
  • Join Date: Jan 2003
  • Posts: 253
  • Country: pl
  • Thanked: 1 times
  • Gender: Male
  • Hardware designer and programmer
    • Show only replies by krashan
    • Personal homepage
Re: Sudominator 0.1 for MorphOS
« Reply #6 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 jj

  • Lifetime Member
  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 4052
  • Country: wales
  • Thanked: 2 times
  • Gender: Male
    • Show only replies by jj
Re: Sudominator 0.1 for MorphOS
« Reply #7 on: September 01, 2010, 08:44:21 PM »
I am really interested in coding on MorphOS what books would you suggest I read or good web tutorials for learning C ?
“We don't stop playing because we grow old; we grow old because we stop playing.” - George Bernard Shaw

Xbox Live: S0ulA55a551n2
 
Registered MorphsOS 3.13 user on Powerbook G4 15"
 

Offline Kronos

  • Resident blue troll
  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 4017
    • Show only replies by Kronos
    • http://www.SteamDraw.de
Re: Sudominator 0.1 for MorphOS
« Reply #8 on: September 01, 2010, 10:24:07 PM »
Quote from: JJ;577159
I am really interested in coding on MorphOS what books would you suggest I read or good web tutorials for learning C ?


Any "beginner" or "dummy" book should do, but make it sure it focusses 100% on ANSI-C (any mention of Microsoft or so and throw it into the bin).

There are also plenty tutorials on the web.

Once you mastered you would be able to write GUI-less MorphOS-apps just like Krashans initial version. Writing MUI-apps or anything specific like libraries will require additional skills.

Learning the syntax is really the easy part, getting your brain to run in C,Pascal or else is the hard part ;)
1. Make an announcment.
2. Wait a while.
3. Check if it can actually be done.
4. Wait for someone else to do it.
5. Start working on it while giving out hillarious progress-reports.
6. Deny that you have ever announced it
7. Blame someone else
 

Offline jj

  • Lifetime Member
  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 4052
  • Country: wales
  • Thanked: 2 times
  • Gender: Male
    • Show only replies by jj
Re: Sudominator 0.1 for MorphOS
« Reply #9 on: September 01, 2010, 10:34:46 PM »
if i am using the editor in the morphos sdk.  How do you then compile and run  ?

Sorry for newbie questions.  I have done some programming but do not understand C compilers
“We don't stop playing because we grow old; we grow old because we stop playing.” - George Bernard Shaw

Xbox Live: S0ulA55a551n2
 
Registered MorphsOS 3.13 user on Powerbook G4 15"
 

Offline Kronos

  • Resident blue troll
  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 4017
    • Show only replies by Kronos
    • http://www.SteamDraw.de
Re: Sudominator 0.1 for MorphOS
« Reply #10 on: September 01, 2010, 10:41:19 PM »
There are the symbols in the toolbar, the 4 blue square "makes" (read the compile following rules set out in the makefile) the white on green arrow runs.

That should be enough to test all the examples.

Some example-dirs contain more than 1 prog, you can start these from Ambient, others need special care (screenbars and such).

Not sure how good the "create new project" option is in MorphED compared to CubicIDE (it's commercial succesor)
1. Make an announcment.
2. Wait a while.
3. Check if it can actually be done.
4. Wait for someone else to do it.
5. Start working on it while giving out hillarious progress-reports.
6. Deny that you have ever announced it
7. Blame someone else
 

Offline jj

  • Lifetime Member
  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 4052
  • Country: wales
  • Thanked: 2 times
  • Gender: Male
    • Show only replies by jj
Re: Sudominator 0.1 for MorphOS
« Reply #11 on: September 02, 2010, 10:03:04 AM »
Is there a IDE for MorphOS that helps designing GUI ?
 
Or does it need to be done by hand ?
“We don't stop playing because we grow old; we grow old because we stop playing.” - George Bernard Shaw

Xbox Live: S0ulA55a551n2
 
Registered MorphsOS 3.13 user on Powerbook G4 15"
 

Offline Kronos

  • Resident blue troll
  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 4017
    • Show only replies by Kronos
    • http://www.SteamDraw.de
Re: Sudominator 0.1 for MorphOS
« Reply #12 on: September 02, 2010, 10:11:21 AM »
There are few tools, but in the end you have to learn MUI, and if you learned MUI writing up the GUI using those macro-calls is trivial and will cost you no more time than doing it click&point.
1. Make an announcment.
2. Wait a while.
3. Check if it can actually be done.
4. Wait for someone else to do it.
5. Start working on it while giving out hillarious progress-reports.
6. Deny that you have ever announced it
7. Blame someone else
 

Offline jj

  • Lifetime Member
  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 4052
  • Country: wales
  • Thanked: 2 times
  • Gender: Male
    • Show only replies by jj
Re: Sudominator 0.1 for MorphOS
« Reply #13 on: September 02, 2010, 10:31:39 AM »
okay fair enough
 
I have got C and C++ for dummies book in the house so will give things a whirl.
 
Thanks for help
“We don't stop playing because we grow old; we grow old because we stop playing.” - George Bernard Shaw

Xbox Live: S0ulA55a551n2
 
Registered MorphsOS 3.13 user on Powerbook G4 15"
 

Offline Linde

  • Sr. Member
  • ****
  • Join Date: Mar 2004
  • Posts: 457
    • Show only replies by Linde
    • http://hata.zor.org/
Re: Sudominator 0.1 for MorphOS
« Reply #14 on: September 02, 2010, 12:23:34 PM »
Cool! The next step should be a solvable puzzle generator of varying difficulty :)