C++.NET

Moderators: Lundin
Number of threads: 99
Number of posts: 163

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
SUDOKU PUZZLE CODE!!!! Posted by MAGABENE on 26 Apr 2006 at 7:40 AM
HI! CAN SOMEONE PLEASE HELP ME WRITE THE CODE FOR THIS PROGRAM OR AT LEAST HELP ME WITH THE ALGORITHM.

PROGRAM DESCRIPTION:

Sudoku is a numerical puzzle. The puzzle consists of 9x9 squares arranged in a grid. This grid is further subdivided into 3x3 squares of size 3x3. Some numbers are initially placed on the grid. To solve the puzzle, a number between 1 and 9 (inclusive) must be selected for each square that is empty so that:

No number is duplicated in any row.
No number is duplicated in any column.
No number is in any of the 3x3 subgrids.
Write a program that allows a user to specify and solve a sudoku puzzle. Initially the 9x9 grid is empty, the user types in the numbers that are given for the puzzle. Thereafter, the user types in the numbers that he/she has computed to solve the puzzle at each stage.

Display the puzzle on the screen, with the entered numbers after each new number is entered. Note: The user can choose to enter a new number at any position he/she chooses, as long as there is no number there already.

After all squares have been filled with a number, check that the puzzle is a solution by making sure that the above constraints are satisfied. Note: there may be many, or perhaps no solutions to the puzzle.


Report
Re: SUDOKU PUZZLE CODE!!!! Posted by Faz on 14 May 2006 at 2:26 PM
I have made my own Sudoku solver in Visual Basic. Ideally a Sudoku puzzle will only have one solution, that is how I made the solver. Are you looking to make your own solver or creator?

I think the best way to do a creator, is to start initially with a filled in grid and get the program to remove random cells one at a time, and after it takes away each cell it has to make absolutely sure that there is still only one solution to the puzzle. It's difficult to be certain of leaving it with one solution, but I'll have a good think about this.
Report
Re: SUDOKU PUZZLE CODE!!!! Posted by shellyrivers on 27 Nov 2009 at 9:59 PM
I agree with faz that's likley yur best approach to this, or even better just go to a few of the online sudoku solvers out there sudoku solver is one however there's many. and just study the code it will open your eyes if your currently still stuck.
Report
Re: SUDOKU PUZZLE CODE!!!! Posted by shellyrivers on 27 Nov 2009 at 10:01 PM
duplicate entry



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.