Results 1 to 9 of 9
Thread: Sudoku solver with threads
- 05-25-2010, 08:05 PM #1
Member
- Join Date
- May 2010
- Posts
- 3
- Rep Power
- 0
- 05-26-2010, 12:36 AM #2
Try debugging the code with some println statements to show execution flow and how variable values are changing.
Or to get help here, can you strip your code down and post all of the code so we can see what is happening.Last edited by Norm; 05-26-2010 at 03:08 AM.
- 05-26-2010, 08:43 PM #3
I see three calls to new Brett( .. but only two of them call the start() method afterwards.
Where in your code does it find a solution to the first row?
- 05-26-2010, 09:44 PM #4
Sorry, I don't understand your language. So I can't read your variable names or comments.
Was there a missing start() call?
- 05-26-2010, 11:21 PM #5
What about this one?
Have you tried adding debugging println statements so you can see how the execution flows? When I did, the code created and started 2 threads.//lager et nytt board
board = new Board(str, numberOfRowsInBox, numberOfColumnsInBox, squares);
}Last edited by Norm; 05-26-2010 at 11:24 PM.
- 05-26-2010, 11:42 PM #6
Member
- Join Date
- May 2010
- Posts
- 3
- Rep Power
- 0
if i only use brett.copy() when it finds a solution to first row on this board:
6
2
3
..1..3
......
....2.
26....
...3..
3..1.2
i get:
421563
000000
000020
260000
000300
300102
421653
000000
000020
260000
000300
300102
451263
000000
000020
260000
000300
300102
521463
000000
000020
260000
000300
300102
521643
000000
000020
260000
000300
300102
541263
000000
000020
260000
000300
300102
621453
000000
000020
260000
000300
300102
621543
000000
000020
260000
000300
300102
641253
000000
000020
260000
000300
300102
651243
000000
000020
260000
000300
300102
but when i use this in
Board b = new Board(str, numberOfRowsInBox, numberOfColumnsInBox, board.copy());
it will only start this first thread, but not the rest. It should start 10 threads, and from those 10 it should find 28 solutions
- 05-27-2010, 02:08 AM #7
Why do you think that?should start 10 threads
Put in some println() statements to show when and why the program creates threads.Have you tried adding debugging println statements so you can see how the execution flows? When I did, the code created and started 2 threads.
- 05-27-2010, 08:58 AM #8
Member
- Join Date
- May 2010
- Posts
- 3
- Rep Power
- 0
I guess because there are 10 solution like this:
421563
000000
000020
260000
000300
300102
and whenever it finds one of this it is supposed make a new board and start(); which will call the recursive method from (1, 0) and continue solving the board.
After adding println statements I found out it stopped after making a new board() in the recursive method. So i wonder if the threads are trying to work on the same board. Have I missed any pointers to the new board or something?
- 05-27-2010, 03:07 PM #9
Similar Threads
-
Error from sudoku class
By hongi in forum New To JavaReplies: 4Last Post: 05-08-2010, 02:08 PM -
Sudoku randomizer help
By mochibon in forum New To JavaReplies: 0Last Post: 04-07-2010, 03:05 AM -
How to best design a calculus solver
By xcallmejudasx in forum New To JavaReplies: 4Last Post: 06-25-2009, 05:27 AM -
SUDOKU game problem
By bumblyb33 in forum AWT / SwingReplies: 2Last Post: 05-05-2009, 11:18 PM -
Rubiks Cube Solver
By sufs2000 in forum Advanced JavaReplies: 0Last Post: 06-03-2008, 03:20 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks