pet(bichon_frise_dog). pet(collie_dog). pet(himalayan_cat). pet(parot). pet(canary). pet(goldfish). pet(rainbow_fish). pet(lionfish). pet(horse). pet(miniture_pony). pet(flemish_giant_rabbit). pet(tortoise). pet(rat). pet(mouse). pet(boa_constrictor). pet(tree_frog). pet(gecko). pet(monkey). pet(guinea_pig). pet(hampster). pet(gerbil). pet(ferret). pet(tarantula). lives_at(bichon_frise_dog, country). lives_at(bichon_frise_dog, city). lives_at(collie_dog, country). lives_at(collie_dog, city). lives_at(himalayan_cat, country). lives_at(himalayan_cat, city). lives_at(parot, country). lives_at(parot, city). lives_at(canary, country). lives_at(canary, city). lives_at(goldfish, country). lives_at(goldfish, city). lives_at(rainbow_fish, country). lives_at(rainbow_fish, city). lives_at(lionfish, country). lives_at(lionfish, city). lives_at(horse, country). lives_at(miniture_pony, country). lives_at(flemish_giant_rabbit, country). lives_at(tortoise, country). lives_at(tortoise, city). lives_at(rat, country). lives_at(rat, city). lives_at(mouse, country). lives_at(mouse, city). lives_at(boa_constrictor, country). lives_at(boa_constrictor, city). lives_at(tree_frog, country). lives_at(tree_frog, city). lives_at(gecko, country). lives_at(gecko, city). lives_at(monkey, country). lives_at(monkey, city). lives_at(guinea_pig, country). lives_at(guinea_pig, city). lives_at(hampster, country). lives_at(hampster, city). lives_at(gerbil, country). lives_at(gerbil, city). lives_at(ferret, country). lives_at(ferret, city). lives_at(tarantula, country). lives_at(tarantula, city). purchase_price(gecko, cheap). purchase_price(guinea_pig, cheap). purchase_price(hampster, cheap). purchase_price(rat, cheap). purchase_price(mouse, cheap). purchase_price(goldfish, cheap). purchase_price(tortoise, cheap). purchase_price(canary, cheap). purchase_price(ferret, moderate). purchase_price(gerbil, moderate). purchase_price(lionfish, moderate). purchase_price(tree_frog, moderate). purchase_price(collie_dog, moderate). purchase_price(parot, moderate). purchase_price(flemish_giant_rabbit, moderate). purchase_price(tarantula, expensive). purchase_price(boa_constrictor, expensive). purchase_price(bichon_frise_dog, expensive). purchase_price(rainbow_fish, expensive). purchase_price(himalayan_cat, expensive). purchase_price(miniture_pony, expensive). purchase_price(horse, expensive). purchase_price(monkey, expensive). supplies_cost(guinea_pig, cheap). supplies_cost(hampster, cheap). supplies_cost(tortoise, cheap). supplies_cost(tree_frog, cheap). supplies_cost(collie_dog, cheap). supplies_cost(tarantula, cheap). supplies_cost(boa_constrictor, cheap). supplies_cost(rat, cheap). supplies_cost(mouse, cheap). supplies_cost(goldfish, moderate). supplies_cost(canary, moderate). supplies_cost(gecko, moderate). supplies_cost(ferret, moderate). supplies_cost(himalayan_cat, moderate). supplies_cost(gerbil, moderate). supplies_cost(rainbow_fish, moderate). supplies_cost(flemish_giant_rabbit, moderate). supplies_cost(lionfish, expensive). supplies_cost(bichon_frise_dog, expensive). supplies_cost(miniture_pony, expensive). supplies_cost(parot, expensive). supplies_cost(horse, expensive). supplies_cost(monkey, expensive). child_friendly(bichon_frise_dog). child_friendly(flemish_giant_rabbit). child_friendly(himalayan_cat). child_friendly(guinea_pig). child_friendly(hampster). child_friendly(goldfish). child_friendly(miniture_pony). interactive(bichon_frise_dog). interactive(himalayan_cat). interactive(horse). interactive(guinea_pig). interactive(hampster). interactive(collie_dog). interactive(ferret). interactive(gerbil). interactive(miniture_pony). interactive(monkey). lazy(tortoise). lazy(tree_frog). lazy(tarantula). lazy(boa_constrictor). lazy(rat). lazy(mouse). lazy(goldfish). lazy(canary). lazy(gecko). lazy(rainbow_fish). lazy(flemish_giant_rabbit). lazy(lionfish). lazy(parot). need_friendly(X, yes) :- child_friendly(X). need_friendly(X, no) :- pet(X). need_play(X, yes) :- interactive(X). need_play(X, no) :- lazy(X). can_buy(expensive) :- can_pay_to_buy(X), X >= 100. can_buy(moderate) :- can_pay_to_buy(X), X >= 35. can_buy(cheap) :- can_pay_to_buy(X), X < 35. can_buy(cheap) :- can_pay_to_buy(X), X >= 35. can_support(expensive) :- can_pay_weekly(X), X >= 50. can_support(moderate) :- can_pay_weekly(X), X >= 15. can_support(cheap) :- can_pay_weekly(X), X < 15. can_support(cheap) :- can_pay_weekly(X), X >=15. good_pet :- findall(P,(lives_at(P, H), home_at(H)),L1), findall(P,(purchase_price(P, D), can_buy(D)),L2), intersection(L1,L2,L3), findall(P,(supplies_cost(P, E), can_support(E)),L4), intersection(L3,L4,L5), findall(P,(need_friendly(P, F), i_have_kids(F)),L6), intersection(L5,L6,L7), findall(P,(need_play(P, G), play_with_pet(G)),L8), intersection(L7,L8,L9), write('You should consider getting: '), nl, write(L9), nl. find_pet :- write('Do you live in the city or country? '), read(Home), assert(home_at(Home)), write('How much do you want to spend on the pet? '), read(Purchase_amount), assert(can_pay_to_buy(Purchase_amount)), write('How much can you spend per week on supplies? '), read(Supply_amount), assert(can_pay_weekly(Supply_amount)), write('Do you have children, yes or no? '), read(Have_kids), assert(i_have_kids(Have_kids)), write('Do you want to play with your pet, yes or no? '), read(Play_with), assert(play_with_pet(Play_with)), nl, good_pet, retract(home_at(Home)), retract(can_pay_to_buy(Purchase_amount)), retract(can_pay_weekly(Supply_amount)), retract(i_have_kids(Have_kids)), retract(play_with_pet(Play_with)).