0% found this document useful (0 votes)
49 views4 pages

DSA Microproject Report

The document summarizes a micro-project to develop a Sudoku solver using the backtracking algorithm in C++. The project aims to create a program that can solve any Sudoku puzzle by taking the values as input. Backtracking is used to systematically try possibilities to find a solution. The output shows the solved Sudoku board. Developing this project helped skills like object-oriented programming, understanding algorithms, and problem-solving abilities.

Uploaded by

Nutan Bhor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views4 pages

DSA Microproject Report

The document summarizes a micro-project to develop a Sudoku solver using the backtracking algorithm in C++. The project aims to create a program that can solve any Sudoku puzzle by taking the values as input. Backtracking is used to systematically try possibilities to find a solution. The output shows the solved Sudoku board. Developing this project helped skills like object-oriented programming, understanding algorithms, and problem-solving abilities.

Uploaded by

Nutan Bhor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Micro-Project Report

Institute Code: 4117 Academic Year: 2022-23


Program: Computer Engineering Course: Data structure and algorithms
Course Code: 210252 Pattern: 2019
Semester: 4 Date : / /

1.0 Title of Micro-Project: Sudoku solver

2.0 Problem Definition :


Develop a sudoku solver using backtracking algorithm.

3.0 Rationale:
Backtracking algorithm is used for developed a sudoku solver.
Backtracking algorithm: backtracking is a technique to solve problems where multiple choices
are there and we don’t know the correct choice and hence we solve problem with trial and error
i.e. trying each option until the problem is not solve. We basically check that the same number is
not present in current row, current column and current 3*3 sub grid. After checking for safety, we
assign the number, and recursively check whether this assignment doesn’t lead to solution, then
we try next for current empty cell. And if none of number (1 to 9) lead to solution, we return
false.

4.0 Aim /Benefits of Micro-Project:


The aim of this project is to develop a sudoku solver that anyone can solve any sudoku
by simply just providing sudoku values. Backtracking algorithm is used for developing the
sudoku solver.

5.0 Course Outcomes Achieved (COs):


CO 1: Identify the real-life problem from societal need point Of view.
C04: Design the reliable and scalable solution to meet challenges.
C05: Evaluate the solution based on the criteria specified.

4.0 Literature Review:


We used many sources to make this micro project. Some of them are described below:-
1. Website:
a) Wikipedia.org: This website gave us a specific and detailed information
b) geeksforgeeks: This website gave the information about backtracking algorithm.
c) ChatGPT : This is an open AI software.

5.0 Actual Methodology followed:


Initially, project topic was finalized. After the discussion the aim and procedure to create project
was discussed. The project proposal was then prepared. Then we gathered the information about our project from
the various resources as suggested by our guide. We used the resources like presentations, books, internet, etc.
After all the information was gathered, this information was shared to prepare a final presentation. Collecting
Information and images for the presentation was done by. After a thorough study over the topic and preparation
of the presentation a report was then prepared by at the end, all the documents were submitted to the guide along
with the viva by us.
6.0 Actual Resources used:

S. No. Name of Resource/material Specifications Qty Remarks


1 Microsoft Power Point Office Power Point 2013 01 For making presentation on the
topic.
2 Microsoft Word Office Word 2013 01 To prepare documents of the
project
3 Notebook A4 size notebook 01 To record information related to
project
4 Visual studio code Version:1.78 01 To write a code for sudoku solver

6.0 Project code


#include <iostream>
#define N 9
using namespace std;
int grid[N][N] = {
{3, 0, 6, 5, 0, 8, 4, 0, 0},
{5, 2, 0, 0, 0, 0, 0, 0, 0},
{0, 8, 7, 0, 0, 0, 0, 3, 1},
{0, 0, 3, 0, 1, 0, 0, 8, 0},
{9, 0, 0, 8, 6, 3, 0, 0, 5},
{0, 5, 0, 0, 9, 0, 6, 0, 0},
{1, 3, 0, 0, 0, 0, 2, 5, 0},
{0, 0, 0, 0, 0, 0, 0, 7, 4},
{0, 0, 5, 2, 0, 6, 3, 0, 0}
};
bool isPresentInCol(int col, int num){ //check whether num is present in col or not
for (int row = 0; row < N; row++)
if (grid[row][col] == num)
return true;
return false;
}
bool isPresentInRow(int row, int num){ //check whether num is present in row or not
for (int col = 0; col < N; col++)
if (grid[row][col] == num)
return true;
return false;
}
bool isPresentInBox(int boxStartRow, int boxStartCol, int num){
//check whether num is present in 3x3 box or not
for (int row = 0; row < 3; row++)
for (int col = 0; col < 3; col++)
if (grid[row+boxStartRow][col+boxStartCol] == num)
return true;
return false;
}
void sudokuGrid(){ //print the sudoku grid after solve
for (int row = 0; row < N; row++){
for (int col = 0; col < N; col++){
if(col == 3 || col == 6)
cout << " | ";
cout << grid[row][col] <<" ";
}
if(row == 2 || row == 5){
cout << endl;
for(int i = 0; i<N; i++)
cout << "---";
}
cout << endl;
}
}
bool findEmptyPlace(int &row, int &col){ //get empty location and update row and column
for (row = 0; row < N; row++)
for (col = 0; col < N; col++)
if (grid[row][col] == 0) //marked with 0 is empty
return true;
return false;
}
bool isValidPlace(int row, int col, int num){
//when item not found in col, row and current 3x3 box
return !isPresentInRow(row, num) && !isPresentInCol(col, num) && !isPresentInBox(row -
row%3 ,
col - col%3, num);
}
bool solveSudoku(){
int row, col;
if (!findEmptyPlace(row, col))
return true; //when all places are filled
for (int num = 1; num <= 9; num++){ //valid numbers are 1 - 9
if (isValidPlace(row, col, num)){ //check validation, if yes, put the number in the grid
grid[row][col] = num;
if (solveSudoku()) //recursively go for other rooms in the grid
return true;
grid[row][col] = 0; //turn to unassigned space when conditions are not satisfied
}
}
return false;
}
int main(){
if (solveSudoku() == true)
sudokuGrid();
else
cout << "No solution exists";
}
7.0.Output of the project
[?2004l
316 |578 |492
529 |134 |768
487 |629 |531
---------------------------
263 |415 |987
974 |863 |125
851 |792 |643
---------------------------
138 |947 |256
692 |351 |874
745 |286 |319
[?2004h

8.0 Skill Developed / Learning outcome of this Micro-Project:


Developing a sudoku solver using C++ can help in Developing various skills such as:
Object-oriented programming skills
Understand the concept of graph.
Understand the backtrack algorithm
Logic-building is improved.
Problem-solving and critical thinking skills

9.0 Applications of Project:


1. Helps to reduce anxiety and stress.
2. Problem solving and decision making.

11.0 Name of Group Members:

PRN Roll No. Seat No. Name of Students Student Signature

72266353G 06 Nutan Tanhaji Bhor


72266356M 22 Samruddhi Rajesh Gorhe
72266358H 29 Piyush Balasaheb Kale
72266363D 67 Bhushan Keda Shewale

Date: / / Evaluated by: Dated Signature of Guide: __________________


Name of Guide: Prof. M.D.karad

You might also like