Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- start;
- intialize board;
- add initial values;
- display
- "Welcome to Sudoku";
- do
- {
- display
- 1.Continue the Puzzle
- 2.Check avaliable values in a given square
- 3.Reset The Puzzle
- 4.Exit the Program;
- switch(choice)
- {
- case 1 :
- while (Input Validation While Loop: Column between 1-9)
- {
- Ask What row?;
- row=i.nextInt();
- if( Input Validation for Row)
- "Sorry, that is an invalid input, please try again.";
- }
- while (Input Validation While Loop: Row between 1-9)
- {
- Ask What Row;
- col=i.nextInt();
- if( Input Validation for Column)
- "Sorry, that is an invalid input, please try again.";
- }
- while (Input Validation While Loop: Value between 1-9)
- {
- Ask for value;
- val=i.nextInt();
- if( Input Validation for the value)
- "Sorry, that is an invalid input, please try again.";
- }
- ;
- addGuess(row,col,val);
- break;
- // end choice 1
- case 2 :
- while (Input Validation While Loop Between 1-9)
- {
- display
- "What row?";
- if( Input Validation While Loop Between 1-9)
- display
- Sorry, that is an invalid input, please try again.";
- }
- while (Input Validation While Loop Between 1-9)
- {
- display
- "What column?";
- if( Input Validation While Loop Between 1-9)
- display
- "Sorry, that is an invalid input, please try again.";
- }
- display
- getAllowedValues(puzzle1,row,col);
- break;
- // end choice 2
- case 3 :
- reset(puzzle);
- display
- "Puzzle Reset";
- break;
- //end choice 3
- case 4 :
- System.exit(0);
- break;
- //end choice 4
- }
- }while(isFull(puzzle1) == false && checkPuzzle(puzzle1) == true);
- display
- "You have won!!!!!";
- }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement