AI Minor Project Jas
AI Minor Project Jas
ARTIFICIAL INTELLIGENCE
MINOR PROJECT
BACHELOR OF TECHNOLOGY
(Computer Science and Engineering)
Submitted By:
Ekta walia
D3 CSE A2
CRN: 2215038
URN: 2203427
Ludhiana, 141006
INDEX
S. Topic Page No. Sign.
No.
1. Introduction 1
2. Objectives 2
3. Code 3-6
4. Output 7
5. Conclusion 8
Page|3
INTRODUCTION
articles to blogs and news reports—has significantly increased the demand for efficient
methods of information retrieval. Users often face the challenge of quickly extracting relevant
information from large documents, especially in situations where time is of the essence.
Automatic text summarization has become a crucial focus within the field of Natural
Language Processing (NLP), offering solutions to generate concise summaries that retain key
This project introduces a Python-based Sudoku puzzle generator and solver as a practical
example, where the key objective is to handle the large amount of data generated by the Sudoku
algorithm. The code effectively generates Sudoku puzzles and provides functionality to solve
them, while allowing users to interact with the system. Although primarily demonstrating
algorithmic problem-solving, this project mirrors the broader aim of summarization techniques
OBJECTIVES
• To create a Python-based system that generates and solves Sudoku puzzles efficiently,
• To offer a user-friendly interface where users can generate new puzzles, view the
solved puzzle, and understand how algorithmic techniques such as backtracking work in
CODE
random
% 3) + r // 3 + c) % 9
random.sample(s, len(s))
def gen_s(empty_cells=50):
rBase = range(3)
for _ in range(empty_cells):
return board
def
print_board(board): for
line in board:
def find_empty(board):
for r in range(9):
for c in range(9): if
board[r][c] == 0:
return (r, c)
return None
return False
box_x = pos[1] // 3
box_y = pos[0] // 3
Page|7
return False
return True
def solve(board):
find = find_empty(board)
if not find:
return True
else:
board[row][col] = i
if solve(board):
return True
board[row][col] = 0
Page|8
return False
def code():
board = None
while True:
a = input("Enter operation: (new: for generating, ans: for showing answer and exit:
if a.lower() == 'exit':
break
board = gen_s()
print_board(board)
elif a.lower() ==
None:
solve(board)
print_board(board)
Page|9
else:
print("No Sudoku board generated yet! Please generate one first using 'new'.")
else:
print(f"You have entered invalid input: {a} (Enter only 'new', 'ans', and
print("Welcome........")
code()
OUTPUT
P a g e | 10
CONCLUSION
This project successfully demonstrates the process of generating and solving Sudoku puzzles
using Python. The development of this interactive system highlights the importance of
algorithmic thinking and efficient coding practices in tackling logical challenges. While the
project focuses on Sudoku puzzles, the concepts applied here—such as generating data and then
condensing it into a solution—parallel broader applications like text summarization, where vast
By achieving the objective of creating a working Sudoku system, this project emphasizes how
algorithmic solutions can simplify complex problems. Future work could explore integrating
this system with more advanced techniques, such as artificial intelligence, to develop Sudoku
solvers capable of handling even more complex variations of the game. Additionally, the code
can serve as a foundation for more complex applications in fields like game theory, machine