Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PROLOG PROGRAMMING You are to develop a dialogue engine that will interact with the user. Assignment 2: Kids day at school Assume that the prolog

PROLOG PROGRAMMING

You are to develop a dialogue engine that will interact with the user.

Assignment 2: Kids day at school Assume that the prolog script is a parent, trying to know about a kids day at school. The prolog script should converse intelligently with the kid as follows. The prolog script should ask a question to the kid that kid can answer in yes or no. Depending on whether the answer is yes or no, prolog script should ask a related question or another random question. For example, if the kid says yes to whether it ate or not, the query can be a food item, or whether the kid used fork or spoon, or whether the kid washed hand. Similarly, related to games.

This code was given in the assingment description and can be used as a base:

image text in transcribed

Ask(0). Is starting command and to provide the feedback y/q are the options y. yes, n. no, q. quit the script. The users choices will be stored in like(X) and dislike(X). like(X). will store yes choices, dislike(X) will store no choices (nothing is dummy initialization only).

TalkingBoPrologOnlyf1 [modified! File Edit Browse Compile Prolog Pce Help Tal ask (0):- ask (Y):- print ("Hey... Do you like "), validate_andquery_options ([trekking]) generate_options (Y,L), validate_and query_options (L) generate options (Y,L):- validate_and query_options (L):- t(History,H)subtract (S,H,Valid), member (X, Valid), print (X),print'2 y/q:)read (Like),(Likeabort:Like-y -> assert (like (X)) assert (disl like (Y), print ("Great.. . Do you like",findnsols (100, X,related (X, Y),L) print ("Huh... May be you like",findnsols (100, X, random (X) , L). findnsols (100,X,like (x), Likelist), findnsols (100,X, dislike (X), Dislikelist), append (Likelist,Dislikelist, History), list_to set (L,S), list_to_se ike (X)),ask (X) related (X,Y):- romantic (L),member (X,L, member (Y,L) outdoorsy (L),member (X,L),membe (Y,L) social (L) member (X,L),member (Y,L) health freak (L),member X,L) member (Y,L): loner (L),member (X,L) member (Y,L) random (X): romantic (A), outdoorsy (B), social (C), health freak (D), loner (E append (A, B, AB), append (AB, C,ABC), append (ABC, D, ABCD), append (ABCD, E, ABCDE), r andom member (X, ABCDE) romantic (Igifts,wine, dinner, candlelight, rains, tea, concert,night,poetry,music,movie, dating,magic,novels, stories,roses,bouquets, courtship,chickflicks, cr uise,breeze,diaries,painting]) outdoorsy picnic, trekking, soccer, sports,jogging, kayaking,parks, event, woods,mountains,beaches,cricket,action movies, dogs,lakes, fairs,swimming,breze,f itness,water]) social lcoffee,picnic,friends,party,beer,music,concert, event,movie, soccer, dinner,gifts,gardens, roses, flowers, bouquet, cricket,board_games, cafe,netfli x, dogs,networking, exhibitions, fairs,debates]) health freak [sports,tea, fruitjuice, smoothie,trekking,training,jogging, soccer, sweating,sleeping, swimming,lakes,exercise, burpees, fitness,cats,water, mus ic]) loner [books, coffee, woods, candlelight, sleeping,training, jogging, night,tea,beaches, poetry,tea, rains, fiction, novels,board games, netflix, cats,music,pain ting, sketching,writing, diaries]) like (nothing) dislike (nothing). Colourising buffer.. done, 0,02 seconds, 161 fragments Line: 32 TalkingBoPrologOnlyf1 [modified! File Edit Browse Compile Prolog Pce Help Tal ask (0):- ask (Y):- print ("Hey... Do you like "), validate_andquery_options ([trekking]) generate_options (Y,L), validate_and query_options (L) generate options (Y,L):- validate_and query_options (L):- t(History,H)subtract (S,H,Valid), member (X, Valid), print (X),print'2 y/q:)read (Like),(Likeabort:Like-y -> assert (like (X)) assert (disl like (Y), print ("Great.. . Do you like",findnsols (100, X,related (X, Y),L) print ("Huh... May be you like",findnsols (100, X, random (X) , L). findnsols (100,X,like (x), Likelist), findnsols (100,X, dislike (X), Dislikelist), append (Likelist,Dislikelist, History), list_to set (L,S), list_to_se ike (X)),ask (X) related (X,Y):- romantic (L),member (X,L, member (Y,L) outdoorsy (L),member (X,L),membe (Y,L) social (L) member (X,L),member (Y,L) health freak (L),member X,L) member (Y,L): loner (L),member (X,L) member (Y,L) random (X): romantic (A), outdoorsy (B), social (C), health freak (D), loner (E append (A, B, AB), append (AB, C,ABC), append (ABC, D, ABCD), append (ABCD, E, ABCDE), r andom member (X, ABCDE) romantic (Igifts,wine, dinner, candlelight, rains, tea, concert,night,poetry,music,movie, dating,magic,novels, stories,roses,bouquets, courtship,chickflicks, cr uise,breeze,diaries,painting]) outdoorsy picnic, trekking, soccer, sports,jogging, kayaking,parks, event, woods,mountains,beaches,cricket,action movies, dogs,lakes, fairs,swimming,breze,f itness,water]) social lcoffee,picnic,friends,party,beer,music,concert, event,movie, soccer, dinner,gifts,gardens, roses, flowers, bouquet, cricket,board_games, cafe,netfli x, dogs,networking, exhibitions, fairs,debates]) health freak [sports,tea, fruitjuice, smoothie,trekking,training,jogging, soccer, sweating,sleeping, swimming,lakes,exercise, burpees, fitness,cats,water, mus ic]) loner [books, coffee, woods, candlelight, sleeping,training, jogging, night,tea,beaches, poetry,tea, rains, fiction, novels,board games, netflix, cats,music,pain ting, sketching,writing, diaries]) like (nothing) dislike (nothing). Colourising buffer.. done, 0,02 seconds, 161 fragments Line: 32

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What is conservative approach ?

Answered: 1 week ago

Question

What are the basic financial decisions ?

Answered: 1 week ago