Hi,


Ok, if we are both confused about what it's asking, lets look at the function requirements.

2. (a) Write an oz function {Attack U V} whose input parameters U and V are both squares in the form col#row. The function should
       return true if U and V are on the same row, column or diagonal;
       otherwise it should return false.
No problem with that.

(b) Write an oz function {Threaten L U} whose L is a (possibly empty) list of squares in the form col#row and whose input pa-
       rameter U is a square in the same form. The function should
       return true if U is attacked, in the sense of the Attack function
above, by any of the squares in L ; otherwise it should return false.
No problem with that either.

   (c) Write an oz function {Queens L N} whose input parameter N is
       the board size, and whose input parameter L is a non-empty list of
       squares in the form col#row, whose rows run consecutively from 1,
       L being a partial solution of the N queens problem. The function
has to extend L if this is possible to a full solution of the N queens
       problem, returning this as a list of squares in the same col#row
       form. Otherwise, if no such extension is possible, the function
       must return an empty list.

To me that reads pretty explicit that the list contains tuples, but then I _DID_ have to email the tutor about what C really asks, so I may just be confused over the wording of the assignment. If so, please do correct me cos if my understanding of what it's asking me is wrong then my implementation will also be wrong.
Yes, that makes it very,very clear!
The only thing in that case that looks possibly wrong to me is in the {Queens} function. It calls {Revise} with 0|L but if L is a list running FROM 1 then surely this is moving the columns along and creating a new first column?
Is it the case that the 0 should be added at the end of L and then Revised?
Notice i'm getting less confident the more i confuse myself? :+)

I'm beginning to wish I hadn't said anything at all because it seems like i've wasted your time exploring problems that don't exist!

If it makes you feel more comfortable, I think you've interpreted the wording just fine.

Regards
Mark

--
Mark Richardson
Final year undergraduate
University of Teesside
_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to