Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Mathmatically create sudoku puzzles?

Does anybody know if there is a formula that you can use to create sudoku puzzles randomly? I script in GML as well as LSL and I've been asked to make a randomly generated sudoku puzzle game. Can anybody help me create a working formula? All I was able to find on this matter is this confusing forum post here...

http://www.sudoku.com/boards/viewtopic.php?t=44&po...

3 Answers

Relevance
  • 1 decade ago
    Favorite Answer

    My approach would be to start filling in spaces on a blank board pretty much randomly, then running a solver (I've written a couple of those) at each step to see how many solutions there are. As soon as you get to there being just one solution, you can stop, or if you want it to be easier to solve, you can add some number of the other values from the solution. If while adding number before getting to a single solution you instead arrive at a "no solution" state, you will need to backtrack, removing the number you added to give you no possible solutions, and try a different number and/or location. I could write this in C++, Java, or C# in maybe a few hours. I did search online to see if there are any standard ways of generating Sudoku puzzles but instead found many different ideas with no agreement as to which is likely to yield suitable puzzles. It's not clear that the approach I outlined will always yield "suitable" puzzles, but one you are generating some, their suitability can be assesed, and, potentially, improvements to the alogorithm can be devised to improve the results. As far as how a scripting language can be used for this, I'm not seeing it, due to their lower power compared to general purpose languages, but then I don't use scripting languages that much, so there could be potential there that I'm not seeing.

    Source(s): Programming for 40 years.
  • 5 years ago

    Colour code the numbers, easier for your brain to process the patterns! It is after all, knitting with numbers. Always look for the numbers in line, then boxes. The rest is just a combination of the two. Practise and you will find out more connections between the boxes and lines. Keep in mind that if the other two of the 3x3 boxes already have numbers that are not in the line you are working on, then the number will be in the 3 squares of that other box. That is one clue many fail to recognise. Try practising to see more patterns. It helps to have a good memory, Sudoku can require you to remember old clues alot of the time. You might want to mark out recent finds and new clues according to the order you find them. Also, there is no luck involved in Sudoku, or "probabilities and possibilities." Each and every single number has it's set of "clues", always remember that! Never ever try your luck no matter how probable and possible it seems. You might get lucky but you will never improve like that. Best of all, do this with a friend, it helps that someone else goes nuts with you when you fail to solve the puzzle. Enjoy.

  • 1 decade ago

    Maybe you can just use a widget?

    http://www.widgetbox.com/widget/sudokupark

Still have questions? Get your answers by asking now.