• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
2d array and random number generator
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

2d array and random number generator


  • Subject: 2d array and random number generator
  • From: Carl Clayton <email@hidden>
  • Date: Sun, 25 Sep 2005 19:22:16 +0100

Hi, I'm trying to build a SuDoku 9x9 grid of random numbers with 9 3x3 sub grids, and obviously the numbers 1 - 9 should not repeat in certain parts of the grid. I chose to use a 2d array containing 81 random integers, and then made a function that checked each part of the array to correct numbers that had repeated where they shouldn't.

here is an example of part of the check function:

do
chk[9+1;
5]||

chk[2]||

chk[3]);

I know this must look very crude, but in actual fact it does work, it's just that it seems to get stuck in an infinite loop sometimes when ran. Is this because of using too many 'or' operators.
Don't be too critical, I am pretty new at all this, and there is probably easier an way.

Cheers,
Carl.

p.s. Layman's terms please!
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: Design tools, unexpected layout changes
  • Next by Date: Overriding the C++ Operator new
  • Previous by thread: Re: Design tools, unexpected layout changes
  • Next by thread: Re: 2d array and random number generator
  • Index(es):
    • Date
    • Thread