i trying create prolog program can tell type of animal attributes give. homework not asking me, asking understanding. here list of facts have created:
has_hair. produces_milk. has_long_incisors. gnaws_on_wood. lives_near_water. has_bushy_tail. striped. eats_meat. eats_plants. has_feathers. can_fly. has_hooked_beak. can_swim.
and rules have made:
raccoon :- [omnivore, lives_near_water, has_bushy_tail],[]. muskrat :- [lives_near_water, rodent], [has_bushy_tail]. squirrel :- [rodent, has_bushy_tail], []. rat :- [rodent], [has_bushy_tail, striped]. chipmunk :- [rodent, striped], [has_bushy_tail]. wolverine :- [mammal, has_bushy_tail, carnivore], []. eagle :- [bird, can_fly, has_hooked_beak, carnivore], []. ostrich :- [herbivore], [can_fly, can_swim]. penguin :- [carnivore, can_swim], [can_fly]. has_long_incisors :- [gnaws_on_wood],[]. eats_plants :- [gnaws_on_wood], []. omnivore :- [eats_meat, eats_plants], []. carnivore :- [eats_meat], [eats_plants]. herbivore :- [eats_plants], [eats_meat]. mammal :- [has_hair, produces_milk], []. rodent :- [mammal, has_long_incisors], []. bird :- [has_feathers], [].
in problem description have been given example:
classify([has_feathers, eats_meat, has_hooked_beak, can_swim], [can_fly, eats_plants],x).
where first list attributes animal has, , second attributes not. in example above x should equal penguin.
i don't understand how supposed use classify. need re-write rules this:
classify([rodent, has_bushy_tail], [], squirrel)
or supposed make sort of function type thing called classify? new prolog please excuse me if exceedingly simple.
thank can offer.