From: Les Hammer on
> Your program didn't work for me.  It immediately filled in the grid without any opportunity to plant the seeds first.
Yes, you must plant the seeds first, then hit the "run" button.  When the program is started it immediately does a "solve."  And it solves a completely blank (all zero) problem with the first solution that fits.
>  I also tried seeding the numbers before running the VI, but it kept changing my inputs back to zeros.
I've noticed that with LabVIEW.  Originally I had all the cells at the default - left justified.  That let me "easily" enter the numbers, but didn't present a good looking display.  So I switched the cells to "center justify."  That makes the display look better, but then LabVIEW insists that you highlight the number and all of the display to the left of it in order to change the number.  (Maybe this is a Windows problem.).
~~Les
From: jdebuhr on
Sheldon Stokes wrote:

I wrote a SuDoku solver this weekend, not specifically to solve them, but to generate new ones.  The first step in generating a puzzle is to fill in the board which is really a ?solving? operation.  Then the program removes most of the solved cells and presents it to the user.  I use a tabbed interface with the solution hidden on another tab. 

 

I have two subVI?s and it?s quite readable.  I can post it when I return from a business trip if there is interest.

 
I wrote it to wring out my algorithm, rather than as a finished application.  I?m now porting my code to objective-c for a Cocoa Mac OS X application that prints puzzles MxN on a page to be solved.  I have been using websudoku but with only one per page, it?s a pain to print out, and a waste of paper. 
 
Sheldon


Sheldon,
If you could post the subVIs that would be great, I have a co-worker that is hooked on doing them and this way he could generator new ones.
thanks
Jeff
From: mcsynth on
Les,
This weekend I wrote a helper application for Sudoku puzzles (LV 7.1).  It doesn't fully solve the puzzle, but it keeps track of the remaining possibilities in each cell.  It the puzzle is easy, it pretty much solves it for you, but if the puzzle is tough, the VI will still allow you to make most of the choices yourself.  I would only use it to help break a deadlock.
It is not complete, and requires a few more hours to clean it up.  First off, after you must key in each number, you must click OUTSIDE the table.  If you click in another cell, the current Edit Position property will be wrong.
Once you have entered all the clues (I call them "seeds"), click the "Seeded" button.  This changes the color of the entry blocks, blue for seeds and yellow for guesses.
It can still have a little trouble with changing your guess after a number has been entered, especially going from a number back to a blank, but it's almost there.  I also need to change the color scheme to make the grids more defined.
I'd also like to put some import/export capabilities in it to save partial solutions for later retrieval.
Mcsynth
 


SUDOKU Helper.llb:
http://forums.ni.com/attachments/ni/170/156474/1/SUDOKU Helper.llb
From: Les Hammer on
> It doesn't fully solve the puzzle, but it keeps track of the remaining possibilities in each cell.
That looks good.
> but if the puzzle is tough, the VI will still allow you to make most of the choices yourself. 
I haven't looked at the details of your solution, but it would be good to have a "go back" capability.  That is, have some buttons for "Save 1", "Recall 1", "Save 2", "Recall 2" ...  That way if you make a bad choice you don't have to start from scratch.
> I would only use it to help break a deadlock.
Yes -- helps keep the puzzle a puzzle.  My solver zips through and solves the puzzle in a matter of seconds -- the only challange was in writing the solver and seeing how quickly I could get it to solve.  There's no challange in the puzzle itself since the program does it all.  Your program does the tedious stuff while letting the user still have the challange.  Good work!
> It can still have a little trouble with changing your guess after a number has been entered, especially going from a number back to a blank, but it's almost there.  I also need to change the color scheme to make the grids more defined.
Some other solutions alternate the 3x3 blocks into yellow/grey.  It would be good if you can easily correct bad seeds.  That is "oops, I put the 3 in cell 6E instead of 7E.  How do I clear 6E?"
 
~~Les
 
From: mcsynth on
Les
>I haven't looked at the details of your solution, but it would be good to have a "go back" capability.  That is, have some buttons for "Save 1", "Recall 1", "Save 2", "Recall 2" ...  That way if you make a bad choice you don't have to start from scratch.
That's where the import/export feature will come in handy (If I have enough ambition to write it someday).
>Some other solutions alternate the 3x3 blocks into yellow/grey.  It would be good if you can easily correct bad seeds.  That is "oops, I put the 3 in cell 6E instead of 7E.  How do I clear 6E?"
If you click the "Seeded" button back to False, you can then put in the correct seed, then click back to True.  Undoing the incorrect seed usually works, but it's not foolproof.  It sometimes requires a bit of trickery (man vs. machine), but I'll see if I can nail that down better.
~~Mcsynth
First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4
Prev: LabView basics
Next: how to configure modbus using LabVIEW?