Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

AI journal with practicals in it, Lab Reports of Artificial Intelligence

AI journal with practicals in it

Typology: Lab Reports

2024/2025

Uploaded on 04/19/2025

atharva-tare
atharva-tare 🇮🇳

1 document

1 / 51

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
INDEX
Sr.No
Topic
1
GNU Prolog
2
BFS
3
DFS
4
TOWER OF HANOI(PROLOG IF,ELSE)
5
Family Tree
6
Water Jug
7
Word Search
8
AO*
9
Missionaries & cannibals
10
Shuffle deck
11
N Queen
12
Tensor Flow
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33

Partial preview of the text

Download AI journal with practicals in it and more Lab Reports Artificial Intelligence in PDF only on Docsity!

INDEX

Sr.No Topic

1 GNU Prolog

2 BFS

3 DFS

4 TOWER OF HANOI(PROLOG IF,ELSE)

5 Family Tree

6 Water Jug

7 Word Search

8 AO*

9 Missionaries & cannibals

10 Shuffle deck

11 N Queen

12 Tensor Flow

Practical No 1 Date 07/08/

Q) Gnu Prolog (A)

Output:-

Gnu Prolog (C)

Output:-

Gnu Prolog (D)

Output:-

Gnu Prolog (E)

Output:-

Output:-

Q2) Expert System

Output:-

Q3) AND OR PROLOG

Q4) Accept the values from the user and add it.

—> code:-

Output:-

Q5) Write a program to print hello world?

Submitted To :- Ananya Mam

Output:-

Practical No :- 3

Q2) DFS

—> Code:-

graph = { 'A': ['B', 'C'], 'B': ['D', 'E'], 'C': ['F', 'G'], 'D': [], 'E': [], 'F': [], 'G': [] }

queue = [] def dfs(graph, node, goal): queue.append(node) while queue: s = queue.pop(0) print(s, "\n") if s == goal: print("The goal state", goal, "has been reached") return True for neighbor in graph[s]: if neighbor not in queue: # Prevent revisiting nodes queue.append(neighbor) for i in graph[neighbor]: if i not in queue: queue.append(i) goal = input("Enter the goal state you want to reach: ") dfs(graph, 'A', goal)

Output:-

stack.extend(neighbor for neighbor in reversed(graph[s]) if neighbor not in visited) print(f"The goal state {goal} was not found") return False graph = { 'A': ['B', 'C'], 'B': ['D', 'E'], 'C': ['F', 'G'], 'D': ['H', 'I'], 'E': ['J', 'K'], 'F': ['L'], 'G': ['M', 'N'], 'H': [], 'I': [], 'J': [], 'K': [], 'L': [], 'M': [] } goal = input("Enter the goal state you want to reach: ") dfs(graph, 'A', goal) Output:-

graph = {

'A': ['B', 'C'],

'B': ['D', 'E'],

'C': ['F', 'G'],

'D': ['H', 'I'],

'E': ['J', 'K'],

'F': ['L'],

'G': ['M','N'],

'H': [],

'I': [],

'J': [],

'K': [],

'L': [],

'M': [],

'N':[]

queue = []