Jump to content


Photo
- - - - -

Sudoko Game solver


3 replies to this topic

#1 Wim Soutendijk

Wim Soutendijk

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 211 posts
  • Gender:Male
  • Location:Netherlands

Posted 02 February 2006 - 08:58 PM

After solving a couple of Sudoko puzzles, I decided I could use some help.
So I wrote a PRO-IV function to help me solve the puzzle.

Here in The Netherlands we have two types of Sudoko puzzles: the standard ones and the ones I call Extended Sudoko, they have four extra squares in which the same rules apply (all nine digits must appear in one block only once)

I wrote the function in VIP 5.5927, on a windows 5.5r5.1.8 kernel. If you load it in an older VIP version, the screen formats will not import correctly.

When you fill in the fields, illegal combinations are shown in red. For each field the program calculates the possible values you can select off. If there is only one value possible, that field turns green. The tool tips will always show the possible values. For some puzzles it takes me a while to figure out why there is only one possible value left. Sometimes that is more fun than having the puzzle solved.

There are a couple of buttons on the screen to provide the following features:
Clear the game,
Lock the fields that contain data, I use this after I loaded the initial puzzle. It prevents me retyping those fields my mistake.
Save and Restore the game. One game can have multiple versions: initial puzzle, half way version, and final solution
Undo: lets you go back one step (even the restoring an other version can be undone)
Hints on or off : shows the possible values you can use for each field.
Set game type to standard or extended
Fill in all the fields with only one possible value

I think the basic logic is there to help you solve the puzzle. If you want, you can let the Auto button fill in all the fields it calculated.

I am not happy with the user interface yet. It seems the buttons interact with the input fields, After using the save and restore buttons, I sometimes get an error ENTRY TOO LONG…RE-ENTER

I posted this function for a couple of reasons: to share it with others, to show that you can do more with PRO-IV than building legacy systems, and the most important reason: to improve the software.
I have never worked on an open source project before, but I would like to regard this as open source software. You may modify it, distribute it, as long as you provide full source code with it.
Be my guest to improve the user interface, add some graphics to it, or create a sudoko generator (maybe my next project?)
If you keep me posted of the changes you made, I can incorporate them in a new version, and release them from here. As I said, I have no experience on this so I will have to see how this works out.


Have fun

Wim Soutendijk

Attached Files



#2 Wim Soutendijk

Wim Soutendijk

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 211 posts
  • Gender:Male
  • Location:Netherlands

Posted 02 February 2006 - 08:59 PM

If you open the document with the two examples you will get the picture what I mean with extended
(I could only add one attachment to a post)

Attached Files



#3 Jschuurkes

Jschuurkes

    Member

  • Members
  • PipPip
  • 15 posts
  • Gender:Male
  • Location:Helmond, Netherlands

Posted 03 February 2006 - 09:22 PM

Hi Wim,

Could you please show some screen dumps of the function, so that I can
repair the 'statics' and the buttons in the Single Developer VIP version 5.5921 ;)

Thanks

Jack Schuurkes
It takes months to find a customer, seconds to lose one......

#4 Wim Soutendijk

Wim Soutendijk

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 211 posts
  • Gender:Male
  • Location:Netherlands

Posted 06 February 2006 - 07:40 AM

I received more questions about the VIP version I used.
Attached is a version that will probably work correctly in single developer

Attached Files





Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users