For Programmers: Free Programming Magazines  


Home > Archive > Fortran > December 2005 > Re: Write a Fortran program to solve Sudoku puzzles :-)









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Write a Fortran program to solve Sudoku puzzles :-)
AN O'Nymous

2005-12-05, 7:04 pm


Michael Metcalf wrote:

> 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):


Do you mean that there is no point testing the legality of an element
if it fails one test? In general, unless an element fails, you'd have
to test region + row + column to be certain if it is correct.

> 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


Yes, "y" is correct. We were scrolling across column-y with that do
loop.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com