Wolf, Goat, Cabbage problem again

  • Follow


Hi

  I am having trouble with the farmer, goat, wolf, cabbage problem
for my assignment(!).

The solutions I have seen so far seem complicated, I feel there are
one or two approaches. I also need a compiler: have downloaded
GNU prolog but not sure how to run it,
( have askd for a password for LPA prolog.. )

SO I need

1. A free compiler
for Windows 95

2. Comment on the following solution

 1. Create two lists A and B for east and west bank
 2. Check if MAN is member of the list A or list is empty
 3. Move first item to B This is defined as deleting item
   from list A and adding to list B
 4, Check if list A or list B contains forbidden states
 5. If forbidden state is encountered in list B,
    move first item in list B to list A
    Re- order list A
    and continue with
 6. step 3

In prolog I need to know how to create lists, and use the  member()
function

Thanks

Gehan

0
Reply gehan (1) 4/23/2005 11:23:49 AM

Hi,
I don't want to start argument here but I would say:
 Get Visual Prolog! It is free, does a good job, and you could download an use 
it now.

What exactly do you not understand about the FGWC problem? Post your code and 
explain how you read it and what confuses you, please.

Comments on the algorithm:
Task 2. does not seems to be related to task 3.
      Do you mean "If  MAN is member of A then proceed with task 3."?
Task 3 is to write two predicates :deleting element from a list and appending 
element to a list. The code for that is in every prolog book.
About 4. Forbidden states? You have to define how you understand that? Do you 
mean you compare lists? If so what is the criteria?
About 5. What do you do if forbidden state is encountered in list A? To re-order 
list use any of the list sorting algorithm.


"games" <gehan@dialog.lk> wrote in message 
news:1114255429.210718.26470@g14g2000cwa.googlegroups.com...
> Hi
>
>  I am having trouble with the farmer, goat, wolf, cabbage problem
> for my assignment(!).
>
> The solutions I have seen so far seem complicated, I feel there are
> one or two approaches. I also need a compiler: have downloaded
> GNU prolog but not sure how to run it,
> ( have askd for a password for LPA prolog.. )
>
> SO I need
>
> 1. A free compiler
> for Windows 95
>
> 2. Comment on the following solution
>
> 1. Create two lists A and B for east and west bank
> 2. Check if MAN is member of the list A or list is empty
> 3. Move first item to B This is defined as deleting item
>   from list A and adding to list B
> 4, Check if list A or list B contains forbidden states
> 5. If forbidden state is encountered in list B,
>    move first item in list B to list A
>    Re- order list A
>    and continue with
> 6. step 3
>
> In prolog I need to know how to create lists, and use the  member()
> function
>
> Thanks
>
> Gehan
> 

0
Reply George 4/24/2005 6:41:22 AM


George

 Thanks for the reply! Ihave Visual Prolog, however I am not sure how
to use it

I have installed SI prolog: http://www.swi-prolog.org/, will this be OK
to use?

I was looking for a Prolog for W95, however I will try out SWI prolog
and get back to 
you, doubtless I will have some queries

0
Reply games 4/25/2005 8:04:30 AM

2 Replies
343 Views

(page loaded in 0.032 seconds)

Similiar Articles:





7/29/2012 11:56:42 PM


Reply: