Question: PROLOG PROGRAM : Write a Prolog program for Clothing Fshions using recursion (NO ITERATIVE SOLUTIONS) given the below: ------------------------------------------------------------------------ (1)items of clothing are represented by

PROLOG PROGRAM :

Write a Prolog program for Clothing Fshions using recursion (NO ITERATIVE SOLUTIONS) given the below:

------------------------------------------------------------------------

(1)items of clothing are represented by structures with name and 3 parameters: the type (hat, shirt, etc.), the color (blue, green, etc.) and size (some whole number).

Below is given:

wearing( jane, clothing( hat, red, 3)).

wearing( jane, clothing( shirt, blue, 4)).

wearing( bill, clothing( shirt, purple, 6)).

wearing( tom, clothing( hat, red, 10)).

wearing( jill, clothing( shirt, blue, 2)).

wearing( bill, clothing( hat, green, 10)).

------------------------------------------------------------------------

(2) what is a test query to find all the colors that bill is wearing?

------------------------------------------------------------------------

(3) write a rule (and test it - provide screen shot results please) to find facts of who will be pinched on Saint Patricks Day for not wearing green.

------------------------------------------------------------------------

(4) what will prolog resolve for the following query (run program with Prolog trace on)?

?-wearing(Whom, clothing( hat, red, _)).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!