Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. start;
  2. intialize board;
  3. add initial values;
  4. display
  5. "Welcome to Sudoku";
  6.  
  7. do
  8. {
  9. display
  10. 1.Continue the Puzzle
  11. 2.Check avaliable values in a given square
  12. 3.Reset The Puzzle
  13. 4.Exit the Program;
  14. switch(choice)
  15. {
  16. case 1 :
  17. while (Input Validation While Loop: Column between 1-9)
  18. {
  19. Ask What row?;
  20. row=i.nextInt();
  21. if( Input Validation for Row)
  22. "Sorry, that is an invalid input, please try again.";
  23. }
  24.  
  25. while (Input Validation While Loop: Row between 1-9)
  26. {
  27. Ask What Row;
  28. col=i.nextInt();
  29. if( Input Validation for Column)
  30. "Sorry, that is an invalid input, please try again.";
  31. }
  32.  
  33. while (Input Validation While Loop: Value between 1-9)
  34. {
  35. Ask for value;
  36. val=i.nextInt();
  37. if( Input Validation for the value)
  38. "Sorry, that is an invalid input, please try again.";
  39. }
  40. ;
  41. addGuess(row,col,val);
  42. break;
  43. // end choice 1
  44. case 2 :
  45. while (Input Validation While Loop Between 1-9)
  46. {
  47. display
  48. "What row?";
  49.  
  50. if( Input Validation While Loop Between 1-9)
  51. display
  52. Sorry, that is an invalid input, please try again.";
  53. }
  54.  
  55.  
  56. while (Input Validation While Loop Between 1-9)
  57. {
  58. display
  59. "What column?";
  60.  
  61. if( Input Validation While Loop Between 1-9)
  62. display
  63. "Sorry, that is an invalid input, please try again.";
  64. }
  65.  
  66.  
  67. display
  68. getAllowedValues(puzzle1,row,col);
  69.  
  70. break;
  71. // end choice 2
  72. case 3 :
  73. reset(puzzle);
  74. display
  75. "Puzzle Reset";
  76. break;
  77. //end choice 3
  78. case 4 :
  79. System.exit(0);
  80. break;
  81. //end choice 4
  82.  
  83. }
  84.  
  85.  
  86. }while(isFull(puzzle1) == false && checkPuzzle(puzzle1) == true);
  87. display
  88. "You have won!!!!!";
  89. }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement