Prolog Sample Programs
BIRDS - A sample expert system for identifying birds. The ideas
in this system can be used for any identification type
expert system, including identifying problems based
on symptoms.
CATCH - A sample that illustrates the use of catch/3 and throw/1
for implementing code that processes error exceptions.
CUSTORD - A small sample customer-order-entry system written entirely
in Prolog. It shows how Prolog can be used for both the
database as well as the transaction processing parts of
a business application and encode rules for valid orders
and inventory management.
DCGXPAND - Source code for the DCG -> Prolog translator. This is the
predicate that converts DCG syntax into the equivalent
Prolog, inserting difference lists as appropriate. A compiled
version of this code is included in the base system.
DOSPATH - A DCG program that reads DOS path names, verifies that
they are correct, and splits them into directory and path.
GENE - A collection of rules for family relationships, as well
as rules for saving family data checking semantic integrity
of updates. See ENGLAND.FAM as a sample data file for
a specific family.
MLIST - A sample DCG program that parses address labels into
fields that can be entered in a database. For example,
the label line 'STOW MA 01775' is parsed into city,
state, and zipcode fields. See source code for documentation.
MONEY - A program that solves word arithmentic problems, such
as the famous S E N D + M O R E = M O N E Y.
NANISRCH - The sample adventure game used with the Active Prolog
Tutor.
SHIP - A sample program for presenting various shipping options
for a package or letter. The various options and costs
are computed with a combination of rules, tables and
formulas.
TAXES - A sample program for filling out tax forms, plus an article,
originally published in PCAI, describing how the program
works.
TRAFFIC1 - A very simple application illustrating how to implement a
custom rule language and inference engine for it. The example
uses a goal-driven engine.
TRAFFIC2 - The same rules as in TRAFFIC1.PRO, and another simple
inference engine, but this time a data-driven one.
TXTPAINT - Sample of how to use the DOS mouse predicates. The sample
is TXTPAINT.PRO, a text mode program that allows you
to paint the screen various colors with the mouse. To run
it, type CPI TXTPAINT.
WARPLAN - David Warren's classic planning program, with a number of
sample problems.