Thread: sudoku puzzle

  1. #1
    Registered User
    Join Date
    Nov 2005
    Location
    Alpine, TX
    Posts
    31

    sudoku puzzle

    I am writing a program that will solve the sudoku puzzle I am using a 2d array instead of a 3d array to set up the grid and am wondering, because I did this, would the best way to test for duplicates in a subgrid be setting up a 3x3 matrix and test within that. Or is there another way that I cant think of that I could research.

    This is homework so plz do not post any answers for me(cant believe I am writing This). just ideas that I can try to figure out on my own. I am just starting out and would like to legitimately learn this language. thx.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    1. http://en.wikipedia.org/wiki/Sudoku
    2. Scroll down to the computer solutions
    3. pick a method
    4. pick another method and compare with 3.

  3. #3
    Registered User
    Join Date
    Nov 2005
    Location
    Alpine, TX
    Posts
    31
    my professor has already specified to use the bute force method.
    compare the next possible number entry with their row and column respectively then test the sub grid pertaining to that cell. Im just wondering if their is a different way otherthat a matrix that would cut down on backtracking.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    There is no backtracking in brute force - you simply try every possible combination and see what works.

    Are you wondering whether
    int game[9][3][3];
    is better/worse than
    int game[9][9];

  5. #5
    Registered User fischerandom's Avatar
    Join Date
    Aug 2005
    Location
    Stockholm
    Posts
    71
    I use:
    Code:
    T s[ 81 ];
    And I also use bit-boards. But I don't use brute-force because that is extremely much slower than the technique I use.
    Last edited by fischerandom; 11-26-2005 at 05:43 AM.
    Bobby Fischer Live Radio Interviews http://home.att.ne.jp/moon/fischer/

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 12
    Last Post: 06-06-2008, 05:26 PM
  2. Crossword Puzzle Program
    By Loctan in forum C++ Programming
    Replies: 2
    Last Post: 07-31-2006, 11:08 PM
  3. Sudoku Puzzle Solver?
    By Apocalypse in forum C Programming
    Replies: 7
    Last Post: 03-12-2006, 02:10 PM
  4. Sudoku - the new addiction
    By axon in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 11-07-2005, 11:39 PM