Results 1 to 2 of 2

Thread: sudoku game function help

  1. #1

    Thread Starter
    Hyperactive Member Grunt's Avatar
    Join Date
    Oct 2004
    Location
    Las Vegas
    Posts
    499

    sudoku game function help

    I am trying to figure out a function to see if the current number exists in the sudoku block already. The full sudoku grid is represented by a 2d array of integers. Dont have much so far, still thinking about how I can do this, but all of this coding has fried my brain and im stuck. Ill probably say duh.

    Code:
    private Boolean IsCurrentNumberInBlock(int xloc, int yloc, int[,] ar)
            {
    
            }
    My Mobile Software Development Company - http://www.mbpsoftllc.com

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: sudoku game function help

    If you want to traverse a 2D array then the simplest way is with nested 'for' loops, using the result of calling GetUpperBound for each dimension to get the upper limit for each loop. You can reset a bool before the loops, set it if you find a match and break out of the loops if the flag is set, returning the bool at the end.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width