Re: CSSCGC 2005 Update and Reminder
- From: "Paul F. Johnson" <paul@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 03 Jul 2005 14:44:48 GMT
On Thu, 2005-06-30 at 11:04 +0100, Chris Young wrote:
> On Wed, 29 Jun 2005 16:18:58 GMT da kidz on comp.sys.sinclair were rappin'
> to MC Paul F. Johnson:
>
> > Soduko - well, it would be nice if it ever generated a puzzle instead of
> > getting to 99% and saying "Impossible solution". I'd actually be
> > interested in seeing the listing for this, but I can't get Fuse to
> > interupt it!
>
> Believe me, the code for the geenration routine is 100% genuine - it
> doesn't just print a progress bar and then say "impossible solution",
> unless it really is impossible.
>
> Unfortunately I've not seen it actually generate one yet, so the game
> code is untested.
Let's look at the logic...
Create a couple of loops, set a random value into t and a counter.
Create a new loop to text the first number of the array - the loop goes
as far as the x parameter(n = 1 to 1 to start)
Test if the random number = anything in the array. If it does, generate
again without increasing x.
Do again for the second parameter. The problem here though is that the
first test is performed again even though it originally passed. D'oh!
Okay, let's assume that somehow we've managed to get past that bit of
spaghetti
Set two vars to be the value of the original loop - 1 / 3. So if x = 1,
i = (1 - 1) / 3 and j = (1 - 1) / 3. The loops go from these values + 1
to these values * 3. Okay that's fine for the first loop.
Quick test to see if the random value occurs anywhere in the first 9 x 9
grid. If it does, let's regenerate the entire bloody grid again.
If, somehow, these tests have been passed, actually put the value of the
random number into the grid array and increment x and y (the original
loops).
It's little wonder the grid never gets generated!
TTFN
Paul
--
"The city of Washington was built on a stagnant swamp some 200 years ago
and very little has changed; it stank then and it stinks now. Only
today, it is the fetid stench of corruption that hangs in the air" -
Simpson, L. Mr Lisa Goes to Washington (1991) Fox. 8F01 (Sep).
.
- References:
- CSSCGC 2005 Update and Reminder
- From: deKay
- Re: CSSCGC 2005 Update and Reminder
- From: Paul F. Johnson
- Re: CSSCGC 2005 Update and Reminder
- From: Chris Young
- CSSCGC 2005 Update and Reminder
- Prev by Date: HLA Adventure is now converted to .Z5 format
- Next by Date: Plus D interface
- Previous by thread: Re: CSSCGC 2005 Update and Reminder
- Next by thread: Re: CSSCGC 2005 Update and Reminder
- Index(es):
Relevant Pages
|