Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Prolog fish(shark). fish(tuna). fish(sardine). fish(herring). fish(salmon). mammal(orca). mammal(dolphin). mammal(seal). bird(penguin). plant(seaweed). plant(plankton). eats(shark,tuna). eats(shark,dolphin). eats(shark,seal). eats(shark,turtle). eats(tuna,sardine). eats(tuna,herring). eats(tuna,squid). eats(sardine,plankton). eats(herring,plankton). eats(orca,shark). eats(orca,herring). eats(orca,salmon). eats(orca,dolphin).

Prologimage text in transcribed

fish(shark). fish(tuna). fish(sardine). fish(herring). fish(salmon). mammal(orca). mammal(dolphin). mammal(seal). bird(penguin). plant(seaweed). plant(plankton).

eats(shark,tuna). eats(shark,dolphin). eats(shark,seal). eats(shark,turtle). eats(tuna,sardine). eats(tuna,herring). eats(tuna,squid). eats(sardine,plankton). eats(herring,plankton). eats(orca,shark). eats(orca,herring). eats(orca,salmon). eats(orca,dolphin). eats(orca,seal). eats(orca,penguin). eats(orca,squid). eats(orca,turtle). eats(dolphin, sardine). eats(dolphin,herring). eats(dolphin,salmon). eats(dolphin,squid). eats(seal,sardine). eats(seal,herring). eats(seal,salmon). eats(seal,penguin). eats(seal,squid). eats(seal,turtle). eats(penguin,sardine). eats(penguin,herring). eats(penguin,squid). eats(turtle,squid). eats(turtle,jellyfish). eats(turtle,seaweed). eats(squid,sardine). eats(squid,herring). eats(squid,plankton).

Part 1 (5 marks) Add conditional sentences to ocean.pl to represent the following: 1. (1 mark) A creature is prey if another creature eats it. a. Hint: For the purposes of this question, you can assume that it is okay for a plant to be prey. 2. (1 mark) A creature is a predator if it eats something that is not a plant. a. Hint: You can use the word not in Prolog for negation, e.g. " not(fish(X)) " means " X is not a fish.") 3. (1 mark) A creature is an apexPredator if it is a predator that is not also prey. 4. (2 marks) Creature X is webAbove creature Y (i.e., X is "above Y in the food web) if it either eats Y, or eats something that is webAbove Y. Define this using recursion.|

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

Focus On Geodatabases In ArcGIS Pro

Authors: David W. Allen

1st Edition

1589484452, 978-1589484450

More Books

Students also viewed these Databases questions