Here is a simple Sudoku solver. It should be fairly self-explanatory to use, just input your puzzle into the text boxes and click the Solve button. It comes with a puzzle built in for demonstration purposes. Smile
Download: http://dl.dropbox.com/u/3601919/upload/Sudoku.exe
Source: http://dl.dropbox.com/u/3601919/upload/source.cs
*bump*
I cleaned up the code a little, but does anyone know a faster/more efficient way to store text into a lot of textboxes (the storeArraytoTextBoxes method) or retrieve information from textboxes (the storeNumsToArray method)?
This thing is pretty cool! Nice job. My sugestion for the StoreNumsToArray and storeArraytTextBoxes would be to create an array with all the textboxes and then just do


Code:


            for (int i = 0; i < puzzle.Length; i++)
            {

                    textBox[i] = "" + ((puzzle[i] != 0) ? puzzle[i].ToString() : "");
}


Also, for the whole Dictionary part you could turn it into a loop I believe


(sudo code, I don't know c# but I do know java. Assuming Dictionary is like a hashmap)

Code:

private Dictionary<string, SudokuCell> SudokuCells = new Dictionary<string, SudokuCell>();
for(int a=1; a<=81;a++){
  SudokuCells.put("sudokuCell"+a,new sudokuCell());
}


Note, this won't necessarily work, i dont know how adding things to a Dictionary works in c# but I think you can get the general jist of it
Ah, so I would do something like a Dictionary<> like I did with the cell objects? Hmm, I'll try that.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
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

 

Advertisement