03.06.2013 Views

Turbo Prolog

Turbo Prolog

Turbo Prolog

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

10 Tutorial VIII:<br />

Spreading Your Wings<br />

In this final section of the tutorial, we present some example programs intended to<br />

stimulate your own ideas and to provide further illustration of the topics covered in the<br />

earlier tutorial chapters. Nearly all of the examples offer plenty of room for expansion;<br />

your own ideas can grow into full-blown programs using one of our programs as<br />

a basis. For complete information about the <strong>Turbo</strong> <strong>Prolog</strong> system, see Chapters II<br />

and 12.<br />

BUILDING A SMALL EXPERT SYSTEM<br />

We shall use <strong>Turbo</strong> <strong>Prolog</strong> to construct a small expert system that will figure out which<br />

of seven animals (if any) the user has in mind. It will do so by asking questions and then<br />

making deductions from the replies given. A typical user dialogue with our expert<br />

system might be:<br />

Goal :_run.<br />

has it hair?<br />

yes<br />

does it eat meat ?<br />

yes<br />

has it a fawn color ?<br />

yes<br />

has it dark spots ?<br />

yes<br />

Your animal may be a (an) cheetah !<br />

<strong>Turbo</strong> <strong>Prolog</strong>'s ability to check facts and rules will provide our program with the reasoning<br />

capabilities germane to an expert system. Our first step is to provide the knowledge<br />

with which to reason, shown in Program 51.<br />

109

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!