ARTIFICIAL INTELLIGENCE LAB
(ECS-851)
LABORATORY MANUAL
FOR
Bachelor of Technology
In
Computer Science
Session: 2014-2015
Department of Computer Science & Engineering
KRISHNA ENGINEERING COLLEGE
GHAZIABAD
1
Krishna Engineering College, Ghaziabad
Lab Manual – Artificial Intelligence
ECS-851
ECS-851: ARTIFICIAL INTELLIGENCE LAB
S.No.
Program
Page No.
1
Write a program in PROLOG to find maximum out of 3 numbers
3
2
Write a program in PROLOG to append a List
4
3
Write a program in PROLOG to check Palindrome
5
4
Write a program in PROLOG to print Fibonacci series
6
5
Write a program in PROLOG to find LCM
7
6
Write a program in PROLOG to find GCD
8
7
Write a program in PROLOG to find Prefix, Infix, Postfix
9
8
Write a program in PROLOG to Quick sort
10
9
Write a program in PROLOG to Selection sort
11
10
Water Jug Problem – Implementation in PROLOG
12
11
BFS – Implementation in PROLOG
16
12
DFS – Implementation in PROLOG
19
13
A* Algorithm – Implementation in PROLOG
21
14
8 – Puzzle Problem – Implementation in PROLOG
24
15
Expert System – Implementation in PROLOG
27
2
Krishna Engineering College, Ghaziabad
Lab Manual – Artificial Intelligence
[1].
Write a program in PROLOG to find maximum out of 3 numbers.
Code:
max([X],X).
max([X|Xs],X):- max(Xs,Y), X >=Y.
max([X|Xs],N):- max(Xs,N), N > X.
Output:
3
Krishna Engineering College, Ghaziabad
ECS-851
Lab Manual – Artificial Intelligence
[2].
Write a program in PROLOG to append a List.
Code:
append([],L,L).
append([H|T],L,[H|R]):- append(T,L,R).
Output:
4
Krishna Engineering College, Ghaziabad
ECS-851
Lab Manual – Artificial Intelligence
[3].
Write a program in PROLOG to check Palindrome.
Code:
palindrome(L):- reverse(L,L).
Output:
5
Krishna Engineering College, Ghaziabad
ECS-851
Lab Manual – Artificial Intelligence
[4].
Write a program in PROLOG to print Fibonacci series.
Code:
fib(1,1).
fib(2,1)....