Enjoy an ad free experience by logging in. Not a member yet? Register.

Results 1 to 3 of 3

06142010, 06:52 AM #1
 Join Date
 Jun 2010
 Posts
 3
 Thanks
 1
 Thanked 0 Times in 0 Posts
Need help to confirm whether logic is correct and can be coded in java
hello every one , me and my friend are having a competition amongst our group of friends on who can create a sudoku generator ... game. The plan is to create a puzzle, not randomly generated, but the user can pick 1 of 3. Easy , medium or hard. i have all of my pseudo code down and ready, but i just want somone to go over it, because im sure there are certain parts which are wrong. Thanks for any help you guys give me .
Code:Pseudocode for Sudoku Open second console and display instructions. play again is already given a yes value. Loop while user wants to play again Display title of game (Sudoku) Prompt user to enter difficulty if difficulty is easy board is equal to easy puzzle else if difficulty is medium board is equal to medium puzzle else board is equal to hard puzzle end if ConstructTable() inputNumber(); Prompt user to enter whether they want to check or not. if they do want to check CheckRowsColumns() CheckCells() If checkRowsColumns and checkCells are true display victory message Prompt user to enter whether they want to play again If user wants to play again loop else break end if else change wrong answer color to red loop end if end loop Public static void constructTable (); Declare a 2 dimensional array of integers named board. Set all variables within array to zero. for (int i = 0 ; i < ROWS ; i++) { for (int j = 0 ; j < COLS ; j++) { Print each of the variables in the array } Print out the grid using lines and rectangles } Public static void inputNumber (); Boolean validNumber is true Prompt user to input which row their designated number to change exists within. Prompt user to input which column their designated number to change exists within. Prompt user to input what they want that number to be changed to. if any row or column or new number are less than or equal to zero or greater than nine Display that it is a non valid number Save this row and column number into the same spot within the board and change the value to the value the user inputs. Public static Boolean checkRowsColumns(); Boolean checker is true if there are no wrong values. for (int y = 0; y< 9; y ++) { for (int x = 0 ; x < 9; x ++) { create a string numbers with value “123456789” Check if any row of the board exists within numbers. (board [y][x]) if any number within the row of the board exists within numbers Remove the number which exists from the string of numbers Else This value in the board is wrong } } Public static Boolean checkCells(); Boolean checker is true if there are no wrong values. for (int y = 0; y< 3; y ++) { for (int x = 0 ; x < 3; x ++) { create a string numbers with value “123456789” Check if any row of the board exists within numbers. (board [y][x]) if any number within the row of the board exists within numbers Remove the number which exists from the string of numbers Else This value in the board is wrong } } for (int y = 0; y< 3; y ++) { for (int x = 3 ; x < 6; x ++) { create a string numbers with value “123456789” Check if any row of the board exists within numbers. (board [y][x]) if any number within the row of the board exists within numbers Remove the number which exists from the string of numbers Else This value in the board is wrong } } for (int y = 0; y< 3; y ++) { for (int x = 6 ; x < 9; x ++) { create a string numbers with value “123456789” Check if any row of the board exists within numbers. (board [y][x]) if any number within the row of the board exists within numbers Remove the number which exists from the string of numbers Else This value in the board is wrong } } for (int y = 3; y< 6; y ++) { for (int x = 0 ; x < 3; x ++) { create a string numbers with value “123456789” Check if any row of the board exists within numbers. (board [y][x]) if any number within the row of the board exists within numbers Remove the number which exists from the string of numbers Else This value in the board is wrong } } for (int y = 3; y< 6; y ++) { for (int x = 3 ; x <6; x ++) { create a string numbers with value “123456789” Check if any row of the board exists within numbers. (board [y][x]) if any number within the row of the board exists within numbers Remove the number which exists from the string of numbers Else This value in the board is wrong } } for (int y = 3; y< 6; y ++) { for (int x = 6; x < 9; x ++) { create a string numbers with value “123456789” Check if any row of the board exists within numbers. (board [y][x]) if any number within the row of the board exists within numbers Remove the number which exists from the string of numbers Else This value in the board is wrong } } for (int y = 6; y< 9; y ++) { for (int x = 0 ; x < 3; x ++) { create a string numbers with value “123456789” Check if any row of the board exists within numbers. (board [y][x]) if any number within the row of the board exists within numbers Remove the number which exists from the string of numbers Else This value in the board is wrong } } for (int y = 6; y< 9; y ++) { for (int x = 3 ; x < 6; x ++) { create a string numbers with value “123456789” Check if any row of the board exists within numbers. (board [y][x]) if any number within the row of the board exists within numbers Remove the number which exists from the string of numbers Else This value in the board is wrong } } for (int y = 6; y< 9; y ++) { for (int x = 6 ; x < 9; x ++) { create a string numbers with value “123456789” Check if any row of the board exists within numbers. (board [y][x]) if any number within the row of the board exists within numbers Remove the number which exists from the string of numbers Else This value in the board is wrong } }

06152010, 12:55 AM #2
Wrong forum. This is the JavaScript forum.
You are asking a question about Java.
About the only thing the same in Java and JavaScript are the first 4 letters of their names.Be yourself. No one else is as qualified.

Users who have thanked Old Pedant for this post:
hotdiggity (06152010)

06152010, 01:07 AM #3
 Join Date
 Jun 2010
 Posts
 3
 Thanks
 1
 Thanked 0 Times in 0 Posts
oh snap