Thread: Sudoku 4 by 4 combination lister?

  1. #1
    Registered User
    Join Date
    Feb 2009

    Sudoku 4 by 4 combination lister?

    I am trying to make a c++ program to list all possible combinations for a 4x4 sudoku square. This is how a 4x4 sudoku works (if you don't already know),

    You have 16 numbers that make a square, each one is a different number 1-16. All numbers in row, column, and diagonal have to add up to 34, and the 4 squares have to add up to 34. Example:

    1 4 14 15
    13 16 2 3
    8 5 11 10
    12 9 7 6

    So I'm trying to make a program that will find all the possible combinations, store them in a multidimensional array, and then print out a few of them to make sure it works.

    Does anybody have any tips for me on how I could accomplish this? Or has anybody made/could make a program that already does this that I could look off of and learn from?

    Thanks a lot.

  2. #2
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    New Zealand
    This has nothing to do with a Sudoku or even a part thereof. They never involve suming up values, they only have to be unique per square.
    I suggest changing your thread title (if possible).
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  3. #3
    The larch
    Join Date
    May 2006
    I believe that is called a magic square. I remember there was a nice tutorial on how to list them recursively (and what optimizations and shortcuts are available), but I haven't been able to find it lately.
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sudoku program
    By ElemenT.usha in forum C Programming
    Replies: 1
    Last Post: 02-12-2008, 12:51 PM
  2. Help for a sudoku Solver
    By axilleask in forum C Programming
    Replies: 3
    Last Post: 11-26-2007, 04:28 PM
  3. Newbie with a Sudoku Solver program
    By TylerBill in forum C Programming
    Replies: 13
    Last Post: 03-08-2006, 07:27 PM
  4. Sudoku - the new addiction
    By axon in forum A Brief History of
    Replies: 11
    Last Post: 11-07-2005, 11:39 PM
  5. Mind-Reading chip for the disabled
    By JaWiB in forum A Brief History of
    Replies: 6
    Last Post: 04-04-2005, 12:44 PM