![]() |
|
#1
|
|||
|
|||
sudoku C++, need lots of help :Shi there
i need some help for coding sudoku game ... umm ... i wrote a pseudcode but i need need to implement it , but i dont know how coz am doin c++ for the first time and ma teacher is not helpin!!??:S anyway i will post my pseudcode here and hopfully some one will help me not numbered methods ...a-z class..1-3 steps a filName 1 get file name 2 send the file name to start 3 end fileName method tiim 1 get the limit time 2 send the limit time to timeLim 3 end timm method game1Get 1 get the first game (step game 1) in the giving array sequence “p <cell ID (column, row)> <number>” 2 send the array input to firstGame 3 end game1Get method game2Get 1 get the game (game steps) from the second game to it end, in the giving array sequence “<U/p> <cell ID (column, row)> <number>” 2 send the array input to firstGame 3 end game2get method saver 1 get whether the user/player want to save the game(the last two tables) or not 2 send the input to noYes 3 end saver method b timeLim 1 get time limit from tiim 2 if time limit < 600 and time limit > 10 Send the time limit to 3 else while Send error message and get the input again 4 End loop 5 end timeLim method firstGame 1 get the array input for the first game from game1Get 2 while the input of the first part of the array is != p Send an error message And ask for the input again 3 else if input of the first part of the array = p Check the other array values 4 if the second part of the array input (cell ID (column, row)) first section is Case 1: a, change it to int to {0} then send it to numChecko, break; Case 2: b, change it to int to {1} then send it to numChecko break; Case 3: c, change it to int to {2} then send it to numChecko break; Case 4: d, change it to int to {4} then send it to numChecko break; Case 5: e, change it to int to {5} then send it to numChecko break; Case 6: f, change it to int to {6} then send it to numChecko break; Case 7: g, change it to int to {8} then send it to numChecko break; Case 8: h, change it to int to {9} then send it to numChecko break; Case 9: I, change it to int to {10} then send it to numChecko break; Case 10: while anything else Send an error message And ask for the input again End 5 if the second part of the array input (cell ID (column, row)) second section is Case 1: 1, change it to int to {0} then send it to numChecko break; Case 2: 2, change it to int to {1} then send it to numChecko break; Case 3: 3, change it to int to {2} then send it to numChecko break; Case 4: 4, change it to int to {4} then send it to numChecko break; Case 5: 5, change it to int to {5} then send it to numChecko break; Case 6: 6, change it to int to {6} then send it to numChecko break; Case 7: 7, change it to int to {8} then send it to numChecko break; Case 8: 8, change it to int to {9} then send it to numChecko break; Case 9: 9, change it to int to {10} then send it to numChecko break; Case 10: while anything else Send an error message And ask for the input again End 6 while the last input of the array which is the number or the cell value is <1 && number>9 Send an error message And ask for the input again 7 else the last input of the array which is the number or the cell value is >0 && number<10 Go to numChecko 8 End if and send valid to movZ 9 send variables and the number to the chart 10 send variables to 1Game 11 end firstGame method secGame 1 get the array input for game from game2Get 2 while the input of the first part of the array is != p && != U Send an error message And ask for the input again 3 else if the input of the first part of the array = U Go back to the previous position 4 else if input of the first part of the array = p Check the other array values 5 if the second part of the array input (cell ID (column, row)) first section is Case 1: a, change it to int to {0} then send it to numChecko, break; Case 2: b, change it to int to {1} then send it to numChecko break; Case 3: c, change it to int to {2} then send it to numChecko break; Case 4: d, change it to int to {4} then send it to numChecko break; Case 5: e, change it to int to {5} then send it to numChecko break; Case 6: f, change it to int to {6} then send it to numChecko break; Case 7: g, change it to int to {8} then send it to numChecko break; Case 8: h, change it to int to {9} then send it to numChecko break; Case 9: I, change it to int to {10} then send it to numChecko break; Case 10: while anything else Send an error message And ask for the input again End 6 if the second part of the array input (cell ID (column, row)) second section is Case 1: 1, change it to int to {0} then send it to numChecko break; Case 2: 2, change it to int to {1} then send it to numChecko break; Case 3: 3, change it to int to {2} then send it to numChecko break; Case 4: 4, change it to int to {4} then send it to numChecko break; Case 5: 5, change it to int to {5} then send it to numChecko break; Case 6: 6, change it to int to {6} then send it to numChecko break; Case 7: 7, change it to int to {8} then send it to numChecko break; Case 8: 8, change it to int to {9} then send it to numChecko break; Case 9: 9, change it to int to {10} then send it to numChecko break Case 10: while anything else Send an error message And ask for the input again End 7 while the last input of the array which is the number or the cell value is <1 && number>9 Send an error message And ask for the input again 8 else the last input of the array which is the number or the cell value is >0 && number<10 Go to numChecko 9 End if and send valid to movZ 10 send variables and the number to the chart 11 end secGame method *********************note: if there is a better way to do this plz inform me****************** numChecko 1 get the variables from firstGame and secGame 2 If ‘a’ Case 1: row = 1, check availability in the pointer if space check column and row:: if the number repeated send error message if the number is not repeated Then check 3x3 box if column = a || b || c && row = 1 || 2 || 3 while number repeated in the box send error message ask to input the values again by going by to firstGame or secGame while number is not repeated then put the number in the cell if the cell fill with number send error message Case 2: row = 2 check availability in the pointer if space check column and row:: if the number repeated send error message if the number is not repeated Then check 3x3 box if column = a || b || c && row = 1 || 2 || 3 while number repeated in the box send error message ask to input the values again by going by to firstGame or secGame while number is not repeated then put the number in the cell if the cell fill with number send error message Case 3: row = 3 check availability in the pointer if space check column and row:: if the number repeated send error message if the number is not repeated Then check 3x3 box if column = a || b || c && row = 1 || 2 || 3 while number repeated in the box send error message ask to input the values again by going by to firstGame or secGame while number is not repeated then put the number in the cell if the cell fill with number send error message Case 4: row = 4 check availability in the pointer if space check column and row:: if the number repeated send error message if the number is not repeated Then check 3x3 box if column = a || b || c && row = 4 || 5 || 6 while number repeated in the box send error message ask to input the values again by going by to firstGame or secGame while number is not repeated then put the number in the cell if the cell fill with number send error message Case 5: row = 5 check availability in the pointer if space check column and row:: if the number repeated send error message if the number is not repeated Then check 3x3 box if column = a || b || c && row = 4 || 5 || 6 while number repeated in the box send error message ask to input the values again by going by to firstGame or secGame while number is not repeated then put the number in the cell if the cell fill with number send error message Case 6: row = 6 check availability in the pointer if space check column and row:: if the number repeated send error message if the number is not repeated Then check 3x3 box if column = a || b || c && row = 4 || 5 || 6 while number repeated in the box send error message ask to input the values again by going by to firstGame or secGame while number is not repeated then put the number in the cell if the cell fill with number send error message Case 7: row = 7 check availability in the pointer if space check column and row:: if the number repeated send error message if the number is not repeated Then check 3x3 box if column = a || b || c && row = 7 || 8 || 9 while number repeated in the box send error message ask to input the values again by going by to firstGame or secGame while number is not repeated then put the number in the cell if the cell fill with number send error message Case 8: row = 8 check availability in the pointer if space check column and row:: if the number repeated send error message if the number is not repeated Then check 3x3 box if column = a || b || c && row = 7 || 8 || 9 while number repeated in the box send error message ask to input the values again by going by to firstGame or secGame while number is not repeated then put the number in the cell if the cell fill with number send error message Case 9: row = 9 check availability in the pointer if space check column and row:: if the number repeated send error message if the number is not repeated Then check 3x3 box if column = a || b || c && row = 7 || 8 || 9 while number repeated in the box send error message ask to input the values again by going by to firstGame or secGame while number is not repeated then put the number in the cell if the cell fill with number send error message ****note teacher told me i can use for loop to minmise this but i dont know how????****also the code coz like this for the column b,s,d,e,f,g,h,i but it changes in the checking of 3x3 box and so on****** 3 Note “ the variable go to the firstGame if there is no space filled othere wise it takes it to secGame. “ also , put number in the cell means it takes him to chart and it send valid = true to movZ” 4 end loops 5 end this method noYes 1 get the input from saver 2 if saver input = no || saver input = No Do not save the game 3 else if saver input = yes || saver input = Yes Save the input 4 else while Saver input is != yes || != no || != No || != Yo Send an error message And get the input again 5 end loop 6 end noYes method c timeLimitt 1 get the time limit from timLim 2 get the time calculated 2 if the time limit = calculated time is true Send true to endGame 3 end timLimitt method clcTime 1 get the variables from timeLimitt and movZ 2 if time limit = true start calculating the time 3 send the time calculated to the timelimit, tim10 4 if valid move = true Time send to dispLay 5 end clcTime method tim10 1 get calculated time 2 get number of moves from movZ 3 each 10 second, check if there is any move or backtracks eg. “10 sec, moves=2, 10 sec backtracks=0 4 send after each 10 sec the move data to table1 and the backtracks moves to table2 5 end tim10 method avergTim 1 get the time taking from clcTime method 2 get number of moves and backtrack from moveZ 3 calculate the average time for a move = A(average equation 4 send A to dispLay 5 get A and put it in rage so the qulity of the player can be identify 6 send it to dispLay 7 end avergTim method movZ 1 get valid input from numChecho 2 get U move from secGame 3 each valid input = 1 move. 4 each U = backtrack 5 send move to dispLay, avergTim and tim10 6 end movZ method table1 1 get table vales from tim10 2 set values in a table 3 display the table 4 end table1 method table2 1 get table vales from tim10 2 set values in a table 3 display the table 4 end table2 method ***************note tables are not important for coding but they were essintial in designing***************8 d Start 1 get the file name 2 set the file name = the game name 3 end start method Chart 1 set the chart 012345678910 abc def ghi . . . | . . . | . . . 1 0 . . . | . . . | . . . 2 1 . . . | . . . | . . . 3 2 ----+----+---- 3 . . . | . . . | . . . 4 4 . . . | . . . | . . . 5 5 . . . | . . . | . . . 6 6 ----+----+---- 7 . . . | . . . | . . . 7 8 . . . | . . . | . . . 8 9 . . . | . . . | . . . 9 10 2 set the chart pointer and the memory in the pointer *chart[column][row] = where *chart[9][9] Note” I didn’t count the line <|> between each 3 column and 3 rows<-,+>] 3 run random 28 numbers in different cell 4 if random number exists in the same column || row generate the number again. 5 if not display the chart 6 get the number and the cell id from the other methods 7 save number in the chart as the player/user identify it. 8 display chart with the number that has been set 9 if space available in the chart Get new input 10 if !=space Send true to endGame 11 end chart method dispLay 1 get time taken from calcTimeto to make the move, number of moves and number of backtracks from movZ. 2 display time taken to make the move 3 display number of moves and backtrack 4 get table1 and table2, and average time with the player quality 5 if game ends display table1 and table2 display average time with the player quality 6 end dispLay method endGame 1 get time limit && space in the chart 2 if time limit = true || space in the chart != false End the game 3 end endgame method 1Game 1 get firstGame method variables 2 save the variables in the chart. 3 when undo reaches here stop undo and clear first game variables get first game input again 4 end method thnx for reading anyway |
|
#2
|
|||
|
|||
Re: sudoku C++, need lots of help :Shi there
i just wanna add when u c ... somethin like array[9][9] i mean the box ...but it should be [10][10] |
|
#3
|
||||
|
||||
Re: sudoku C++, need lots of help :Shm... Something tells me that this post isn't going to get alot of responses. The reason being that this is a large project, and noone is going to spend the time to write an entire program like this from scratch. If you do want help from some of us here on the forum (which we would like to help you), you wil have to do more that provide pseudocode. You will need to make a valient effort at doing this assignment, and then asking specific questions about specific areas of your code.
Now that it looks like you've broken the program down into managable parts, implement one part at a time and thoroughly test it before moving on to the next part. Let us know when you get stuck, but make sure to post the problem code... specific questions... and intended results, actual results, etc. Thanks, Trey __________________
If practice makes perfect and nobody's perfect... why practice? Homepage: http://www.treywhite.com Blog: http://www.treywhite.com/blog.php Web Design Company: http://www.ewebproductions.com |
|
#4
|
|||
|
|||
Re: sudoku C++, need lots of help :SQuote:
I agree............ think very logically about ur task at hand 3shtar. do you own coding atleast before we can help u. |
Recent GIDBlog
Writing a book by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| sudoku help | kris5683 | C++ Forum | 2 | 18-Nov-2005 07:58 |
| sudoku | kris5683 | C++ Forum | 1 | 08-Nov-2005 09:48 |
| $4.95/month, 5gig bw,100 pop3, 100 subdomains, MySQL, SSL, SSI, Perl, and lots more | psychojoe | Web Hosting Advertisements & Offers | 0 | 05-Jul-2003 07:00 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The