Help - Search - Members - Calendar
Full Version: Sudoku Panel [DS Contest]
Desktop Sidebar Forums > Customizations > Panel Announcements
Prism
Sudoku Panel for Desktop Sidebar
Version 1.0 released on July 1st, 2005.

Download from the Extension Exchange

What is Sudoku?

I'm proud to release the first game for Desktop Sidebar - Do you have some free time at job? Do you have to finish a project till tomorrow and you really don't want to do it? Is your wife dressing and you have nothing to do?

Play Sudoku in Desktop Sidebar!

Version 1.0 includes:
  • Ability to generate new boards randomly - you won't get two equal boards ever.
  • 3 difficulty levels - for Sudoku beginners and advanced. Choose you level from the panel properties.
  • Every generated Sudoku board can be solved - if you're stuck and don't believe it - choose "Solve board" from the context menu!
  • Did you see a Sudoku board somewhere and you don't know how to solve it? Enter the numbers into the panel and it will solve the board for you!
  • Entering numbers is simple - just click at the field that you'd like to change until the correct number is shown. Middle mouse button can be used to change numbers in reverse.
  • The panel's height automatically match the width. If your board is too small - undock it!

Enjoy yourself a little. biggrin.gif
KeithI
I don't believe it common003.gif. 30 minutes ago I started writing the exact same thing. You must be psychic as well as very clever laugh.gif.

The panel works really well, the only real problem I could find is that the panel flickers alot (I suspect some double-buffering is required) Other than that great work fun_08.gif.

I have a few suggestions:

- Give the user the option to setup the board - then you can solve other peoples puzzles.
- The panel takes up a lot of space in DS. Can you add an option to have the board show up in a details window - which you can pin when you want to. Also, perhaps you can make the size of the squares and font configurable.
- Can you add a "hex" mode. i.e. allow numbers from 0 to 9 and letters A to F - so a 16 by 16 board.

Edit: Sorry I just realised how to setup a board so ignore the first suggestion. I should read the instructions more carefully wink.gif

I suggest you put the "solving" work on another thread as, if it takes a long time, the whole of DS hangs.
GoMa
This panel is great!
Can you make the red lines thicker instead? It's pretty hard on the eyes...
I agree with Keith... the flickering is pretty bad.
I've never heard of hex Sudokus. blink.gif
KeithI
QUOTE(GoMa @ Jul 1 2005, 09:06 PM)
I've never heard of hex Sudokus. blink.gif
*

They are for really clever people laugh.gif

There is one in my newspaper. Very difficult.
Prism
First of all, thanks. smile.gif
I think I'll release the code later, so you can look at its implementation.

Notice the instructions. You can setup the board to solve other people's puzzle.

About the details - I've thought about it, but the undock thing is really helpful here - if you don't want it on your sidebar, you can undock it. If you want it "pinned", just tick the always on top option. Is the details thing really necessary?

Hex mode would be really nice. smile.gif
The only thing I can think about it is that it'll take way to much space, but I guess the undock is helpful here too.

EDIT: Sorry, didn't see your edit. smile.gif
The solving thing doesn't really takes too much time, although it's a recursive function. Again, you'll be able to look at the implementation when I release the code.
Prism
About the flickering: it doesn't flicker so much on my machine, but I'll take a look at double buffering.

I'll thicken the red lines.
KeithI
I'd really like to see the code, that would be great - especially as we are having a contest at work to implement this - so now I can cheat laugh.gif.

You are probably right about the details window. Undock is fine.

I managed to lock DS for about a minute by entering some incorrect values and hitting solve. Perhaps you just need to look at not allowing incorrect values.
yyy
NOOOOOOOOOOOOOOOOOOO hairpull.gif Not this Soduko again - first in the newspaper, then in T.V. and now in DS blink.gif It rules the world ohmy.gif

Just kidding laugh.gif Nice idea for a panel fun_08.gif I just don't understand what's so interesting in numbers and grids - seems like any other thinking game to me whistle.gif

And I though only the newspaper people got crazy about it... biggrin.gif
GoMa
When clicking New Board - I got a insolvable (or rather a board with 4 different solutions). On the four of them, Check Board says Board is OK. Hope I'm not making any obvious mistakes here. ohmy.gif
See screenshot... I have the faulty Sudoku open in the panel if you want me to check something.
yyy - you're right. It's like any other thinking game - addicting. smile.gif
yyy
I said nothing about addicting... whistle.gif laugh.gif

BTW, Prism - you might want to make it easier for people to solve it so if the user puts a number in a square and that number already appears square's row/column, all these numbers will be painted in another color. Then you can immediately see if you put a number which is vaild.
Prism
QUOTE(GoMa @ Jul 1 2005, 11:42 PM)
When clicking New Board - I got a insolvable (or rather a board with 4 different solutions). On the four of them, Check Board says Board is OK. Hope I'm not making any obvious mistakes here. ohmy.gif
See screenshot... I have the faulty Sudoku open in the panel if you want me to check something.
yyy - you're right. It's like any other thinking game - addicting. smile.gif
*



One minute - the board can be solved, right?
I haven't checked how many possibilities are to solve it. I just care that it's solve-able.
Prism
QUOTE(KeithI @ Jul 1 2005, 11:18 PM)
I managed to lock DS for about a minute by entering some incorrect values and hitting solve. Perhaps you just need to look at not allowing incorrect values.
*



Incorrect values are like two same numbers in a row? I think that my algorithm checks for that, but I'll take a look to be sure.

QUOTE(yyy @ Jul 1 2005, 11:47 PM)
I said nothing about addicting... whistle.gif laugh.gif

BTW, Prism - you might want to make it easier for people to solve it so if the user puts a number in a square and that number already appears square's row/column, all these numbers will be painted in another color. Then you can immediately see if you put a number which is vaild.
*



IMHO it'll ruin all the fun. smile.gif
yyy
You can add it to the easy option - for beginners like me rolleyes.gif
GoMa
QUOTE
One minute - the board can be solved, right?
I haven't checked how many possibilities are to solve it. I just care that it's solve-able.

IMO that's pretty bad because this is not a real Sudoku then. While trying to solve this Sudoku I thought and thought and looked and looked (I thought I was missing something) until I finally realized that there were four possible solutions. A Sudoku that has more than one possible solution is considered insolvable (at least that's what I know...).
Prism
Didn't know that. I'll try to improve my generator to create only unique boards in the next version.
GoMa
Thanks. smile.gif
NeilN
Heh. I was just looking for some code last week to help write an implementation of Sudoku for my Pocket PC.
NeilN
QUOTE(Prism @ Jul 1 2005, 05:31 PM)
Didn't know that. I'll try to improve my generator to create only unique boards in the next version.
*



From Wikipedia:
QUOTE
Note that it is possible to set starting grids with more than one solution and to set grids with no solution, but such are not considered proper Sudoku puzzles; like most other pure-logic puzzles, a unique solution is expected. Great caution is required in constructing a Sudoku puzzle, as failing to recognize where a number can be logically deduced at any point in construction - regardless of how tortuous that logic may be - can result in an unsolvable puzzle when defining a future given contradicts what has already been built.


So each puzzle has to have a unique solution which can be arrived at without "guessing".
Prism
AFAIK guessing is required in the "very hard" difficulty level. Can someone confirm?
GoMa
Your panel doesn't have a Very Hard difficulty level. But if you meant not in the panel guessing is sometimes required in hard Sudokus. There is no standard definition for "Easy", "Medium", "Very Hard", etc. - there are also very hard Sudokus which don't require guessing.
NeilN
I don't think so. I've seen someone tackle a very hard level and it seems to be a lot like chess. You need to look 8 or 9 moves ahead and then work backwards, keeping all the possibilities for a square in your head. Very difficult, but no guessing required.
GoMa
Looking 8 or 9 steps ahead is just like guessing (but in your head), if I understand what you said correctly.
EDIT: It's usually done when you have two possible numbers for a square. You put one in, and try to fill in the rest - if it works out - great. If not, you know the other option is the correct one.
Prism
Yep, that's what I ment.
yyy
They say that you have to guess - that's the idea of the game. Look here for more information: http://www.ynet.co.il/home/0,7340,L-3460,00.html (It's in Hebrew but there are probably other similar sites in English too)
GoMa
It's certainly not the idea of the game... the idea is logic. Guessing is stated there as the last step. And anyway that page is not really comprehensive. smile.gif
yyy
That site exaplains some basic stuff. Guessing is one of the ideas - they say that guessing is an integral part of the game.
NeilN
By no guessing I mean it is possible for every puzzle to fill in the squares without having to erase anything. A proper Suduko puzzle:
* is always solvable
* has one unique solution (this is key)

Mathematically these two statements means a suduko is a deterministic finite state machine (hi Professor Campbell!) so that each state can be determined by the previous state. I'm not sure how Prism constructed his solver but if he used constraint programming instead of a brute force technique then he's taking advantage of suduko's deterministic properties.
Prism
QUOTE(NeilN @ Jul 2 2005, 01:50 AM)
By no guessing I mean it is possible for every puzzle to fill in the squares without having to erase anything.
*



But if you look 8-9 steps ahead, and you get a mistake, you erase the steps in your head. It's still guessing.
yyy
Neil means that it's possible not to make a mistake. Some can say it's impossible not to make mistakes, and also less fun, and others can say it is possible.

BTW, If you set it to check the board after chossing a new game it says the board is OK huh.gif
NeilN
QUOTE(Prism @ Jul 1 2005, 07:05 PM)
QUOTE(NeilN @ Jul 2 2005, 01:50 AM)
By no guessing I mean it is possible for every puzzle to fill in the squares without having to erase anything.
*



But if you look 8-9 steps ahead, and you get a mistake, you erase the steps in your head. It's still guessing.
*



Yep, but it's not generally considered a "mistake" but rather eliminating a possibilty. You can either do it on paper or in your head.

Think of it this way: At no point in a properly constructed suduko do you *have* to say "I don't know, this could be a 4, 5, or 9 - I'll just put down 5". You have enough info at the start to make guessing unnecessary.

Contrast this to a maze - there could be only one correct path through it but knowing what you know as you walk through it you have to guess what it is.
Prism
QUOTE(yyy @ Jul 2 2005, 02:07 AM)
BTW, If you set it to check the board after chossing a new game it says the board is OK  huh.gif
*



Did I miss anything? It should be OK, you know. There are no mistakes in it.
yyy
Oh - so you consider mistakes as putting a wrong number in a square. I thought Check Board means that the board should be copmleted and then it checks if there's no mistake.
KeithI
Any sign of the source code? common014.gif
Prism
Sorry, I haven't been here for a long time. Will release it in a few seconds.
KeithI
Excellent fun_08.gif. Thanks prism clap.gif.
thewer
Just an idea - maybe it's totally stupid as I'm new to this game...
Why not make this whole thing skinable by showing symbols instead of numbers on the bar...
The game principle should still work or am I totally wrong there? Only once in each line/colomn/field...
Especially in a small size symbols are better to recognize than numbers... So maybe it would fit on the bar and certainly be more colorful...

As I said I'm new to this game, so if this comment is absolutely ********, just forget instantly please... ;O)
yyy
I know you said your new to the game but I just want to tell you why your suggestion is copmlicated to use - it'll be hard to remember all icons the same way you remember numbers. You'll have to know exactly what kind of icons there are while if you use numbers you already know them.

It's possible to add a small icon near the number if you want rolleyes.gif
Prism
thewer, I can possibly do it, but IMHO, as yyy has mentioned, it'll not make the game easier.


Arrrgh, GoMa, did you have to mention that a Sudoku board with more than one possible solution is not a valid board?
Now I have to think about an algorithm which will check it...
thewer
Ah, all right then... so I better start playing as soon as possible...
(I thought I might remember some symbols easier than numbers - like a beer mug, a football, a sportscar, a computer... wink.gif )
But as I said, I don't now yet how difficult it is...
GoMa
QUOTE
Arrrgh, GoMa, did you have to mention that a Sudoku board with more than one possible solution is not a valid board?
Now I have to think about an algorithm which will check it...

Yes, I had to. I knew this might make things a lot more complicated.
Dunno if you're interested, but here's a GPL Java project that will generate a valid Sudoku.
http://sourceforge.net/projects/sudoku
And the specific file:
http://cvs.sourceforge.net/viewcvs.py/sudo...ava?view=markup
Prism
I'll look at that, thanks.
antu^jamban
After a couple of clicks I decided to solve it so I clicked the solve puzzle menu and the panel froze the whole sidebar. I have to kill DS via task manager.
Prism
Well, that is strange and really shouldn't happen.

Anyway, I declare this project as abandoned. I don't have the time to release a new version till the contest ends.
I might continue developing it in the far future, something like September or October.
Prism
Does anyone know an app which shows all the possible solutions to a Sudoku board?
I've implemented a function myself, but I wanna make sure everything's fine.

Keith, did you implement the code for your work contest? biggrin.gif
GoMa
I trust you. fun_08.gif
KeithI
QUOTE(Prism @ Aug 14 2005, 09:24 PM)
Keith, did you implement the code for your work contest? biggrin.gif
*

As usual I didn't have time to write a solution sad.gif, but a few other people did - 3 in C#, 1 in PL/SQL and 1 in Java. The Java one was really cool. Using a mobile phone with a camera you could take a picture of a grid (in a newspaper for example) and then run the program on the phone to solve it. How good is that?
Prism
Very good indeed. fun_08.gif
Badwolf
QUOTE(Prism @ Jul 1 2005, 03:09 PM)
QUOTE(GoMa @ Jul 1 2005, 11:42 PM)
When clicking New Board - I got a insolvable (or rather a board with 4 different solutions). On the four of them, Check Board says Board is OK. Hope I'm not making any obvious mistakes here. ohmy.gif
See screenshot... I have the faulty Sudoku open in the panel if you want me to check something.
yyy - you're right. It's like any other thinking game - addicting. smile.gif
*



One minute - the board can be solved, right?
I haven't checked how many possibilities are to solve it. I just care that it's solve-able.
*



Apparantly for every soduko puzzle there is, there is only 1 solution. You did a great job either way getting it as good as you did !

I got this one right away ! I was addicted to this game for a while, it was driving me insane with ones I couldnt solve.. lol.. But I did work out some sort of pattern which I've now forgotten, so time to try again !! smile.gif

Nice one !!
Badwolf
QUOTE(yyy @ Jul 2 2005, 02:08 AM)
Oh - so you consider mistakes as putting a wrong number in a square. I thought Check Board means that the board should be copmleted and then it checks if there's no mistake.
*



You cant complete a board with mistakes. The rules are that each 9x9 grid cannot contain the same number twice. Each line connecting the grids also cannot contain the same number twice.

So if you complete a puzzle, and find you have a number in a 9x9 grid twice, or on any line twice, then you have made a mistake, and have not completed it.

You cant guess. You need to eliminate where numbers can't go on grids in order to determine where they can go on surrounding ones... to rule out where they cant be, to find out where that can be.

It's a logical decision you have to make in order to eliminate the possibility of a number existing in connecting grid but not on the same line, or if it doesnt exist but there is the possibility that it might exist on the same line.

You need to be concentrating on as many as 4 different 9x9 boxes at times, and working out by their state if you can allow a certain number to be placed in a box on a surrounding grid.

Confused ? I just fell into a coma... 8-\
Edward Elric
I love the panel... the only problem I have is that I use a dark skin and it's almost impossible to see the black numbers on a dark greyish/black background... Would it be possible to put an option into the properties to pick the color of the numbers?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.