Re: Write a Fortran program to solve Sudoku puzzles :)
 From: "Michael Metcalf" <michaelmetcalf@xxxxxxxxxxxxxx>
 Date: Mon, 05 Dec 2005 15:31:09 GMT
"AN O'Nymous" <a_n_onymous80@xxxxxxxxxxx> wrote in message
news:1133795510.830786.177900@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>>
> ! This section checks the validity of the rows/columns
> do i = 1,9
> count(i) = i
> enddo
>
> do i = 1, 9
> do k = 1, 9
> if (count(k) == sudoku_array(i,y)) then
> count(k) = 0
> endif
> enddo
> enddo
Might I suggest that once count(k) has been set 0 you can exit the 2 loops.
But the whole section is, I think, equivalent to (untested):
kount = ( (/ i, i = 1, 9 /) ) ! count is an intrinsic, so a name to be
avoided
do k = 1, 9
if(any(kount(k) == sudoku_array(:,y) ) ) kount(k) = 0 ! is y correct? do
you mean j?
end do
or even
where (kount == sudoku_array(:,y)) kount = 0
In my own code, I have found count, any and where invaluable.
Regards,
Mike Metcalf
.
 FollowUps:
 Re: Write a Fortran program to solve Sudoku puzzles :)
 From: AN O'Nymous
 Re: Write a Fortran program to solve Sudoku puzzles :)
 References:
 Write a Fortran program to solve Sudoku puzzles :)
 From: AN O'Nymous
 Re: Write a Fortran program to solve Sudoku puzzles :)
 From: R. Vowels
 Re: Write a Fortran program to solve Sudoku puzzles :)
 From: Rich Townsend
 Re: Write a Fortran program to solve Sudoku puzzles :)
 From: AN O'Nymous
 Write a Fortran program to solve Sudoku puzzles :)
 Prev by Date: Book Report (Was: Re: TRIM)
 Next by Date: Re: Parallelization of AERMOD (US EPA atmospheric model) ?
 Previous by thread: Re: Write a Fortran program to solve Sudoku puzzles :)
 Next by thread: Re: Write a Fortran program to solve Sudoku puzzles :)
 Index(es):
Relevant Pages
