Advertisement
Guest User

Untitled

a guest
Feb 27th, 2020
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. if(m[row][col]==0){
  2. for(int num = 1; num<10; num++){
  3. if(tryAddNbr(row,col,num)){
  4. setValue(row, col, num);
  5. if(col<8){
  6. if(solve(row, col+1)){
  7. return true;
  8. }
  9. }else if( col == 8){
  10. if(solve(row+1, 0)){
  11. return true;
  12. }
  13. }
  14.  
  15. }
  16. setValue(row, col, 0);
  17. }
  18. return false;
  19. }
  20. if(col<8){
  21. return (solve(row,col+1));
  22. }else{
  23. return (solve(row+1, 0));
  24. }
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement