|
|
|
 |
|
|
|
|
This section Visual Prolog contains source codes of some Programs & Projects of Prolog implemented in Visual Prolog v5.2 (Personal Edition).
select one of the Topics listed below:
|
Note: All the given files are in zip format, which can be uncompressed with the help of a compression tool. If you do not have any tool, then you can get one from Utilities : Compression Tools. |
|
|
Prolog Basics |
|
|
|
|
|
|
| VP-01 |
 |
A Visual Prolog Program to show the Basic Structure of Prolog. |
| VP-02 |
 |
A Visual Prolog Program to read and Compare two numbers. |
| VP-03 |
 |
A Visual Prolog Program to compute Average of two Numbers. |
| VP-04 |
 |
A Visual Prolog Program that reads two integers and report them in Ascending Order. |
| VP-05 |
 |
A Manager wants to heir some sales persons. He has received 5 applications. Each applicant has stated his Name, City of residence and age. Write 5 Prolog facts after declaring suitable domains and predicates. Some of the applicants know how to type, drive and use computers. Write independent facts randomly for these skills for the above applicants.
The Manager has the following criteria for selecting candidates for interview: "The applicant should be resident of the City where sales person is required, should be more than 30 years, should know how to type and drive".
Write a Prolog Rule to state the above criteria. Complete the program and demonstrate the deductive reasoning.
|
| VP-06 |
 |
Modify the Program VP-05 to include the following:
- All apllicants has declared their qualifications as well.
- A list of degrees declared as facts for graducates degrees.
- Modify the rule so that the applicant is selected only if he is graducated and the previous criteria is met.
|
|
|
|
|
|
Switch-Case Simulation |
|
|
|
|
|
|
| VP-07 |
 |
Develop a program to store facts regarding students, the courses in which they are registered and the course schedule. This information may be declared as following
students(rollnumber,name,age,city)
registered(rollnumber,coursename)
course_schedule(coursename,days,roomnumber)
Develop the menu and supporting rules to enable the user to receive the following information
1- Names and Roll numbersof all students
2- Names of the students registered in a particular course
3- Names of students belonging to a particular city
4- The time table of a particular course
5- Exit
Use dummy names and data of your course.
|
| VP-08 |
 |
Write a declarative program in PROLOG to enable the use of periodic table.
The irst menu may be served as follows with subsequent prompts.
1)- Find an element & its associated properties by entering its atomic number
2)- Find an element & its associated properties by entering its symbol
3)- Find the members of a group of elements (1-8)
4)- Find elements as metals, non metals or noble gases
5)- Exit
Given the following elements only:
GroupNumber Type Symbol AtomicNumber AtomicWeight
1 (M) H 1 1.0079
1 (M) Li 3 6.491
2 (M) Be 4 9.012
3 (NM) B 5 10.811
4 (NM) C 6 12.011
5 (NM) N 7 14.007
6 (NM) O 8 15.999
7 (NM) F 9 18.998
8 (NG) He 2 4.0389
8 (NG) Ne 10 20.170
M = Metal
NM = Non Metal
NG = Noble Gases
|
|
|
|
|
|
Backward & Forwarded Tracking |
|
|
|
|
|
|
| VP-09 |
 |
A Visual Prolog Program to display counting using Forward Tracking. |
| VP-10 |
 |
A Visual Prolog Program to calculate sequential Sum from N to 0 using Back Tracking. |
| VP-11 |
 |
A Visual Prolog Program to calculate Factorial of a Number using Back Tracking. |
| VP-12 |
 |
A Visual Prolog Program to calculate Sequential Sum between two integers using Forward Tracking. |
| VP-13 |
 |
A Visual Prolog Program to calculate Sequential Sum between two integers using Back Tracking. |
|
|
|
|
|
Loop Simulation |
|
|
|
|
|
|
| VP-14 |
 |
A Visual Prolog Program to Simulate the Loop Statement. |
|
|
|
|
|
Lists |
|
|
|
|
|
|
| VP-15 |
 |
A Visual Prolog Program to show the use of Lists (Pointer Types). |
| VP-16 |
 |
A Visual Prolog Program to show the use of Lists (Pointer Types) - 2nd Example.. |
| VP-17 |
 |
A Visual Prolog Program to show the use of Lists (Pointer Types) - 3rd Example. |
| VP-18 |
 |
A Visual Prolog Program to show the use of Lists (Pointer Types) - 4th Example. |
| VP-19 |
 |
A Visual Prolog Program to show the use of Lists (Pointer Types) - 5th Example. |
| VP-20 |
 |
A Visual Prolog Program to show the use of Lists (Pointer Types) - 6th Example. |
|
|
|
|
|
Progressive Reasoning |
|
|
|
|
|
|
| VP-21 |
 |
Progressive/Deductive Reasoning Example
Given the following rules of animal identification and the standard progressive reasoning facility, write a program in Prolog that is able to discover the animal (from the following cheetah, tiger, giraffe, zebra, ostrich, penguin and albatross) that user has thought in his mind.
P01: if the animal has hair, then it is a mammal.
P02: if the animal gives milk, then it is a mammal.
P03: if the animal has feathers, then it is a bird.
P04: if the animal flies, and lays eggs, then it is a bird.
P05: if the animal is a mammal, and eats meat, then it is a carnivore.
P06: if the animal is a mammal, and has pointed teeth, and it has claws, and its eyes point forward, then it is a carnivore.
P07: if the animal is a mammal, and has hoofs, then it is an unsulate.
P08: if the animal is a mammal, and it chews curd, and it is even toed, then it is an unsulate.
P09: if the animal is a carnivore, and it has tawny colour, and it has dark spots, then it is a cheetah.
P10: if the animal is a carnivore, and it has tawny colour, and it has black stripes, then it is a tiger.
P11: if the animal is an unsulate, and it has longest neck, and it has tawny colour, it has dark spots, then it is a giraffe.
P12: if the animal is an unsulate, and it has a white colour, and it has black stripes, then it is a zebra.
P13: if the animal is a bird, and does not fly, and has long neck, and it is black and white, then it is an ostrich.
P14: if the animal is a bird, and does not fly, and it swims, and it is black and white, thenit is a pengiun.
P15: if the animal is a bird, and it is good flyer, then it is an albatross.
|
|
|
|
|
|
Conventional Search |
|
|
|
|
|
|
| VP-22 |
 |
A Visual Prolog Program to show an example of Breadth First Search. |
| VP-23 |
 |
A Visual Prolog Program to show an example of Depth First Search. |
|
|
|
|
|
Visual Projects |
|
|
|
|
|
|
| VP-24 |
 |
First Visual Prolog Project |
| VP-25 |
 |
Age Displayer |
| VP-26 |
 |
Dividing Two Numbers |
| VP-27 |
 |
Usage of List Box |
| VP-28 |
 |
Usage of Radio Buttons |
| VP-29 |
 |
Simple Calculator |
| VP-30 |
 |
Image Displayer |
| VP-31 |
 |
Database - Memory |
| VP-32 |
 |
Database - File Handling |
| VP-33 |
 |
Database - ODBC |
|
|
|
|
|