Welcome! Log In Create A New Profile

Advanced

Ass3 Q3

Posted by maccaroo 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
Ass3 Q3
August 18, 2006 02:48PM
Hi all,

I'm a little stuck with Q3 of Ass3. The point of the exercise is to use assertz and retract to store/remove the paths. Using assertz is fine, and all the required paths are happy added to the database. Using retract is a huge problemo at the moment, since I can't get Amzi/Prolog to retract the path just expanded.

If I use the following statement:

initial_state(X),
assertz(path([X])).

I have no problems. Unfortunately, the opposite doesn't work:

path(X),
retract(path(X)).

On the other hand, if I explicitly say

retract(path([whatever])).

it works! Obviously I can't explicitly program all my retract statements...

Please could someone let me know why this isn't working? Maybe there's a problem with the path already being instantiated in the first term, and so the retract function can't remove it, but how then are we to tell the retract function which path to remove (without keeping it in a dynamic list???)?

Thanks in advance (Apologies for the encyclopedia above...)

Mac
Anonymous User
Re: Ass3 Q3
August 18, 2006 02:55PM
my question is should we change code in section 12.2? or code in fig 11.10 (which just seems generic)?
Re: Ass3 Q3
August 18, 2006 03:01PM
Yeah, the code in 11.10 is generic for a breadth-first search algorithm which uses dynamic lists. We need to at least remove the part which passes the NewPaths to the recursive call. I've left most of the rest the same, since the logic remains.

I guess the main difference is that instead of saying using the conc function, you use the assertz function. Either way the paths get added to the end of the list of possible paths. The problem I have is that the 1st path doesn't want to go away...
Anonymous User
Re: Ass3 Q3
August 18, 2006 03:07PM
what about the section that says "Test your implementation on the eight tiles problem statement given in Section 12.2 of the textbook" To me that means "use the code found in section 12.2"
Re: Ass3 Q3
August 19, 2006 05:38PM
I think it means to use their state representation and transition functions.

It just means we don't need to do that part of the problem in every question. In Q4 we can basically copy most of the code given to us before Q1.

PS - I've figured out Q3. The problem was that I had an exclamation mark in the extend function, which (I don't know why) was buggering the whole thing up! All fixed now smiling smiley
Sorry, only registered users may post in this forum.

Click here to login