Question

Sudoku generator

Asked by: eldraco

I have been interested in sudoku for some time and decided to create a Sudoku game at home.
I have the ability to solve puzzles but would like the source code for the generator of those puzzles. This generator needs to have levels. Any help with source code would be appreciated
Thanx

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2006-05-14 at 22:10:39ID21850280
Tags

sudoku

,

generator

Topic

Delphi Programming

Participating Experts
5
Points
250
Comments
26

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. help me modify a form validation function!! Thanx!
    i have form validation function that just makes sure that the fields are filed out. i want to add if the form is filled out to mave to the next section. i have a form broken down into different <div> tags. i'm making only one section appear at a time. i want the people ...
  2. Crossword Puzzle game
    OK, here's a challange for y'all: I would like to have a crossword puzzle that works in the following manner. The admin should be able to enter an "empty" Javascript frame and by entering letter by letter, filled space, maybe an image, thus step by step building a c...
  3. Deciding for a new programming language ¿?
    I'm trying to decide for a language to learn. I'm still using Foxpro 2.X but I can work with oop. Besides, I know some Html, Visual Basic and Visual FoxPro. At my company, we're working with Foxpro 2.6 and there is a plan to migrate to Oracle and Delphi next year. We don't k...
  4. AI for card games
    I'm trying to write a card game in c++. The game is pitch (hi-lo-jack). I'd like some sort of kick start to the ai portion of the program. Like how to represent the cards and how to tell the computer what to throw. Thanks, Karl

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: wimmeyvaertPosted on 2006-05-14 at 22:36:55ID: 16680055

After some googling, maybe this is something for you :
http://www.buchmanager-berlin.de/homepage/data/projects/sudoku_solver.zip

BEst regards,

The Mayor.

 

by: eldracoPosted on 2006-05-14 at 22:48:13ID: 16680074

Thank you for your quick response but this only displays one puzzle that is hardcoded.
What I require is the ability to generate puzzles at various levels of complexity.

 

by: wimmeyvaertPosted on 2006-05-14 at 23:26:11ID: 16680167

Another link : http://www.1javastreet.com/vb/scripts/ShowCode.asp?txtCodeId=1670&lngWId=7

I was not able to open to project because of the Edit1.BevelInner-property that was missing in my Delphi-Version.
I have Delphi 5. Maybe it was developed for a later version.

Just try it out and let me know.

 

by: eldracoPosted on 2006-05-14 at 23:32:44ID: 16680180

This again uses a hardcoded puzzle.

 

by: wimmeyvaertPosted on 2006-05-15 at 00:49:25ID: 16680392

Hm, Are you sure ?
I opened the project and ignored all warnings.
I then removed 'Variant' from the uses-list
Then I compiled the application and this worked.

When I run the app, I get different puzzles everytime I click on the 'New Sudoku' button

And I can see an Randomize-FunctionCall in the code, So I would expect that the Sudoku-Logic is there to randomly generate a new puzzle.

 

by: DavidBirch2dotComPosted on 2006-05-15 at 00:51:57ID: 16680400

I think this is what you want.

unfortunatley not coded in delphi, but gives everything else to build sudoko for palm PC, including i beleive how to genorate new games

http://msdn.microsoft.com/mobility/tabletpc/articles/techart/default.aspx?pull=/library/en-us/dntablet/html/tbconsudokusamplefinal.asp

David

 

by: eldracoPosted on 2006-05-15 at 01:03:58ID: 16680485

wimmeyvaet
     I tried that myself but all I get is  the same number in the correct places throughout the grid.
Davidbirch2.com
  Thanks for that but I would prefer the solution in Delphi.

 

by: wimmeyvaertPosted on 2006-05-15 at 01:40:13ID: 16680614

Have you tried to click on the 'New SUDOKU'-Button ?
I get a different start-situation every time I click this button.

 

by: eldracoPosted on 2006-05-15 at 01:56:24ID: 16680684

Each time I press this button I get , for example, the number 3 in each 3x3 square in the correct spot e.g The number 3 in the first row of the first 3x3, the number 3 in the second row of the next 3x3 and lastly the number 3 on the bottom row of the third 3x3 etc

 

by: CodedKPosted on 2006-05-15 at 02:11:07ID: 16680759

 

by: wimmeyvaertPosted on 2006-05-15 at 03:02:41ID: 16681000

Hi CodedK,

Your url links to the same application I already provided in one of my previous comments ...

 

by: CodedKPosted on 2006-05-15 at 03:04:27ID: 16681005

Hi wimmeyvaert.
Sorry i didnt check it...

 

by: wimmeyvaertPosted on 2006-05-15 at 03:48:53ID: 16681170

I think I have to say sorry ....
I doublechecked all my comments, and now I see that I never provided this link....
Strange ...
I think I found this one while googling but never posted a comment about it.
So, eldraco check the link of CodedK, this was the one I was referring too...

Ther you have the 'New SUDOKU' button and this is in my opinion the functionality you are looking for ...

So, I have to say sorry and not CodedK.

 

by: eldracoPosted on 2006-05-15 at 14:57:39ID: 16686187

As mentioned previously. The "New Sudoku" button does not generate a sudoku it only fills a single digit in each of the 9 sets of 3x3 squares.

 

by: CodedKPosted on 2006-05-16 at 00:29:09ID: 16688354

Eldraco you want it to create a new sudoku allready solved?

 

by: eldracoPosted on 2006-05-16 at 00:41:04ID: 16688413

If this is possible. I could then clear random cells to create a puzzle.
The previous link uses a hardcoded Sudoku and randomly clears cells in the grid.

 

by: CodedKPosted on 2006-05-16 at 03:08:22ID: 16689053

:) I think this will do !!

http://download.birdiesoft.dk/Sudoku.exe

 

by: eldracoPosted on 2006-05-16 at 03:46:44ID: 16689245

This program solves existing sudoku puzzles but does not create a puzzle

 

by: CodedKPosted on 2006-05-16 at 05:00:46ID: 16689713

No i thing it can.

You create a new empty game then you can write any number you want in any empty space.
Then you can click solve or brute force and it will solve it for you.

 

by: eldracoPosted on 2006-05-16 at 14:21:53ID: 16694502

That is correct. That means you create the Sudoku. I want the computer to create one for me.

 

by: henrythackerPosted on 2006-06-04 at 03:02:32ID: 16826690

I have written a programme which you may not accept as it is quite brute forcing to generate the sudoku, but it will always generate a valid one eventually, it doesn't really take that long - some only take a matter of seconds to generate. The EXE is at http://www.zeekay.com/sudoku.zip  If this looks like what you want, let me know and will be able to release the code for it too. The puzzle generation routine seems to crash occasionally on the medium or expert settings, i can't really understand why this is... When it generates the puzzle, the puzzle is always 100% solvable - im not sure though when you turn it into an actual puzzle, whether it is always 100% possible to solve them. This bit may need tinkering with, but the bare bones are there to use. I can also put in a save/print function if you wanted to increase the point count slightly! ;) You should be fine with this as it is purely a simple TImage it draws the grid into.

 

by: eldracoPosted on 2006-06-04 at 16:09:27ID: 16829182

henrythacker, I have been on holidays and have only now got back.
I have tried your application and it looks good. Please release the code so that I can try it for myself
eldraco

 

by: henrythackerPosted on 2006-06-05 at 09:18:46ID: 16834410

OK, I have uploaded it to: http://www.zeekay.com/SudokuSource.zip

I apologise for the lack of consistent formatting or commenting - I am a Computer Science student, but still the temptation is not to do it the "proper" way when you think no-one else is going to look at your code!

Everything is configurable with hard-coded values, so it should give you a very good starting point, if not a complete solution.

HTH

 

by: cwwkiePosted on 2006-10-05 at 13:09:02ID: 17671893

henrythacker,

I have uploaded your source to http://www.ee-stuff.com/Expert/Upload/getFile.php?fid=986
If you don't agree, you can ask a moderator to remove it, but in that case you won't get any points for this question, because the source is part of the answer.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...