Sudoku Programmers Forum Index

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log inLog in          Games  Calendar

Log in to check your private messagesLog in to check your private messages   

Easy-to-use/nice-looking helper/solver/generator...

 
Post new topic   Reply to topic    Sudoku Programmers Forum Index -> Programming sudoku
View previous topic :: View next topic  
Author Message
droid42

Joined: 29 Jul 2005
Posts: 20
:

Items
PostPosted: Fri Aug 12, 2005 9:28 am    Post subject: Easy-to-use/nice-looking helper/solver/generator... Reply with quote

Hi all,

Keen for feedback on the attached...

http://www.trackvids.co.uk/sudoku/sudoku.html

It's my first "useful" applet since learning Java a couple of weeks ago and, as the subject suggests, is a Sudoku helper/solver/generator.

I designed it to be as easy to use as possible and those of you familiar with the Pappocom Sudoku program will notice some similiarities in terms of look-and-feel, colours, navigation etc.

Here's a summary of the features:-

- Logic-only solving using the following methods:
- simple logic (sole possible in cell, sole possible in row/column/box)
- pointing pairs/triples/nnn
- box/line reduction
- naked pairs/triples/quads
- hidden pairs/triples/quads
- X-Wing/Swordfish/Jellyfish
- Super-colouring (but could be improved)
- Puzzle generation
- Lock cells/restore to locked state
- One save/restore slot
- Highlighting of erroneous input (if generated by the program)
- Pencil-mark display and highlighting
- Highlighting of unique possibles in cell/row/column/box
- Difficulty assessment of any "solvable" puzzle in terms of a simple rating ("very easy" - "diabolical") and specific reporting of the methods required to solve the puzzle

The underlying engine supports much more than the above but I haven't got around to adding UI support. Specifically, the engine is also capable of the following:

- Brute-force/trial&error solving
- "Forcing chains" reduction (not happy with the algorithm yet)
- Grid sizes of up to 25x25 (more if anyone really wants) including the detection of the correspondingly-bigger naked/hidden groups and Swordfish variants

Using it is simple enough. Once the applet has loaded, click on the "New" button to create a new empty grid. "New" will also start from scratch on top of an existing puzzle (including save slots etc.).

"Generate" will produce a random-difficulty puzzle. It tends to produce a lot of "Very Easy" and "Easy" because, quite frankly, my generation algorithm is the area I've spent the least time. Medium/Hard and v.Hard will offer a challenge to most human solvers and I've disabled the generation of "Diabolical" for now (these tend only to be solvable using super-colouring which is beyond the reach of most manual solves).

The difficulty levels are roughly as follows:

Very Easy - requires only simple logic
Easy - ... plus pointing lines and box/line reduction
Medium - ... plus naked pairs/triplets
Hard - ... plus hidden pairs/triplets and x-wing
V.Hard - ... plus naked/hidden quads, swordfish and bigger fish
Diabolical ... all of the above plus super-colouring

"Solve" will attempt to solve what's on the grid using the above reduction methods. If it succeeds it will post the methods it used in the 3rd field on the status bar at the bottom.

"Lock" will lock the cells currently on the grid.
"Reset" will remove all but the locked cells
"Save" saves the current grid in a single save slot...
"Restore" restores the above
"Pencil" cycles through the various pencil-highlighting modes as follows:
- no pencil marks shown
- all pencil marks shown in grey plus "obvious" solves shown in red
- 1's highlighted
- 2's highlighted
- etc.
- back to the top again
"Clear" cleans the current grid (including locked cells) but doesn't interfere with the save slot.

To add numbers to cells just use the cursor keys to navigate around the grid and hit the appropriate number to fill it in. If the program has generated a puzzle and you enter the wrong value into an empty cell, the value will show up as red. (Correct) user input shows up dark grey, computer-solved cells show up green and locked/generated cells show up dark blue. Clicking on cells can be used instead of cursor-key navigation. Hitting the "ctrl" key will temporarily switch off the cell-highlight if it's distracting. Any cursor-key movement or mouse-click will turn it back on again.

I've only tested this on Java runtime 1.5 but it ought to work on lower ones. It uses plenty of Graphics2D stuff (esp. anti-aliasing) and custom colours so apologies in advance if it looks crap on some systems/OS's.

Here's a screenshot...



Ian.
Back to top
View user's profile Send private message
rfb

Joined: 09 Apr 2005
Posts: 26
:

Items
PostPosted: Fri Aug 12, 2005 5:05 pm    Post subject: Reply with quote

The Java applet wouldn't load for me under Mozilla and IE
_________________
Bob
Back to top
View user's profile Send private message
Merri

Joined: 02 Aug 2005
Posts: 44
:

Items
PostPosted: Fri Aug 12, 2005 5:13 pm    Post subject: Reply with quote

Loaded fine for me in Firefox. You probably have to update your Java, mine was upgraded recently.
Back to top
View user's profile Send private message
SteyrerBrain

Joined: 04 Sep 2005
Posts: 1
:

Items
PostPosted: Sun Sep 04, 2005 8:22 pm    Post subject: similar helper Reply with quote

Hi Ian,

nice implementation!

I've concentrated on the helper part implementing a "sudoku assistant":
http://www.profactor.at/~wstoec/sudoku/SudokuAssistant.html
As you will see, many details are very similar (like restricting the possible numbers with simple logic and coloring forced numbers in red).
You might like the additional features:
* numbers are selected by clicking on the pencil-numbers (instead of using the keyboard)
* one can rule-out additional numbers by right-clicking them (using "higher logic" one self). This makes solving sudokus big fun since you can concentrate on the advanced logic, leaving the simple book-keeping to the program.

enjoy,

Wolfgang
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Sudoku Programmers Forum Index -> Programming sudoku All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Sudoku Programmers topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group

Igloo Theme Version 1.0 :: Created By: Andrew Charron