Tim Driven Development | Test until the fear goes away
Campbell Ritchie wrote:Welcome to the Ranch
You will be pleased to know that puzzle has a solution and it is simple to solve.
Please explain your program: what algorithm does it use to solve the puzzle? Also why are you using the keyword static so often? We can only help if we know the algorithm.
Carey Brown wrote:This does not correctly check for solved
What if the starting grid had the entire bottom row filled in, the entire right column, and the entire lower-right square, but all others were zero?
I noticed that in some places you had grid[x][y] and in other grid[y][x].
Tim Cooke wrote:Cross posted here and here. Please read -->BeForthrightWhenCrossPostingToOtherSites
Campbell Ritchie wrote:Apologies accepted
Did your teacher say why you should use static methods?
Syed Irtaza wrote:but the thing is what is wrong with my current coding, that its not giving an out for certain grid.?
Henry Wong wrote:
Syed Irtaza wrote:but the thing is what is wrong with my current coding, that its not giving an out for certain grid.?
Well, I am assuming that it does print the original grid, right? The issue is that it is not printing the result?
Question. How is it not printing the result?
If the program is just ending, and returning to the command prompt, then it is likely that the arrays got corrupted; and somehow, they become zero length. If the program is not returning at all, meaning it just doesn't seem to be doing anything at all, then it is likely that you have an issue with your recursion code, in that it is doing something endlessly. In either case, you need to debug it. Add some print statements, to try to follow it, to try to see what is going on.
Henry
Don't get me started about those stupid light bulbs. |