Sudoku Game Project Report
Sudoku Game Project Report
Thus came the idea to create an Android application that can generate puzzles and
solve them. From the exposure, it can be determining the limitations of the problem are as
follows:
Making this Sudoku game implements the backtracking algorithm on mobile / Android
applications.
The programming language used is java. Supporting software used to make Sudoku
games is Android studio.
Sudoku puzzles used are a standard size 9 x 9 boxes.
The initial element generated consists of a maximum of 36 numbers and a minimum of 27
puzzle numbers that have been filled in with numbers, and each row, column, and block
(3x3) has been filled in at least one box and may not be empty on each of its genera.
Abstraction
Sudoku is a pretty popular number game. The goal of this game is to fill a 9x9 matrix
with unique numbers, and there should not be repeated numbers in each row, column, or
block. This paper proposed a solution to solve Sudoku using the Backtracking Algorithm.
This algorithm is quite efficient because it does not have to check all the possibilities that
exist, but which leads to only the solution that will be processed, namely by pruning
every element that does not lead to the solution. Thus the time required is quite efficient
and suitable for use in reasonably complex numbers games like sudoku. By implementing
the backtracking algorithm in the sudoku game, the complexity of the algorithm can be as
large 𝜽 (n3).
A Sudoku starts with some cells containing numbers and the goal is to solve the
remaking this Sudoku game implements the backtracking algorithm on mobile / Android
applications. Proper Sudoku have one solution. The programming language used is
java. Supporting software used to make Sudoku games is Android studio.
Sudoku puzzles used are a standard size 9 x 9 boxes. The initial element generated
consists of a maximum of 36 numbers and a minimum of 27 puzzle numbers that have
been filled in with numbers, and each row, column, and block (3x3) has been filled in at
least one box and may not be empty on each of its genera. Main cells. One or more
known Sudoku which satisfy or nearly satisfy the characteristic being searched for is used
as a starting point.
Objective
One common method of searching for Sudoku with a particular characteristic is called
neighbour searching. Using this strategy, one or more known Sudoku which satisfy or
nearly satisfy the characteristic being searched for is used as a starting point, and these
Sudoku are then altered to look for other Sudoku with the property being sought. The
alteration can be relocating one or more clue positions, or removing a small number of
clues, and replacing them with a different number of clues.
LITERATURE SURVEY
Existing System
Backtracking Algorithm
D.H. Lehmer was the first to introduce the backtracking algorithm in 1950. The
backtracking algorithm is one of the problem-solving methods included in a strategy
based on searching the solution space, but it does not have to examine all possibilities,
only those that lead to only solutions will be processed. Algorithms backtracking is also
an algorithm that works recursively, where the search process is based on the Depth-First
Search (DFS) algorithm, which is to search for systematic solutions to all possible
solutions and search for answers is done by tracing a tree-shaped structure rooted. There
for this algorithm is quite powerful and very good to be applied in problem-solving and to
provide artificial intelligence in the game. Several types of digital games that are
generally commonly known by the public, such as Chess, Math Maze, Tic Tac Toe, to
Sudoku can be found a solution by implementing the backtracking algorithm.
The objectives of the proposed Project is to increase the Thinking Capability. The
Game having all the records which u perform in playing you can Select Easy, hard level
according to your choice. You can make your own Sudoku and at any Step you can go
back to One Step as well as you can see the Solution of it. It is manually a very difficult
job to perform and its need a lot of recalling, reminding and mathematical calculation.
The game of “Sudoku” helps to increase mental thinking, vision etc.
REQUIREMENT SPECIFICATION
Project Requirement Specification
Project requirement are conditions or tasks that must be completed to ensure the
success or completion of the project. They provide a clear picture of the work that needs
to be done. They’re meant to align the project’s resources with the objectives of the
organization.
Software Requirements
Operating System : windows 7, windows 8, windows 10
Design : XML
Tools : Android Emulator Android SDK-ADK-bundle-
windows-x86 Jdk-8u66-windows-x86
Hardware Requirements
Languages
Design Decisions
Analysis process is designed to provide an overview of all processes that occur as
well as provide an overview of the parts of the system being designed. In this study, the
process flow shown by a flowchart, which is an algorithm flowchart. The backtracking
algorithm flowchart is a data flow based on an existing algorithm. In this flowchart, the
running algorithm process is explained from the beginning to the end. The backtracking
algorithm's diagram is illustrated in figure 1.
Add Number
New Game
Hint
Show Solution
Complete
player Puzzle
Setup game
board
Show hint
Show solution
System
Check puzzle
Display time
used
Block Diagram of Sudoku Game
6. IMPLEMENTATION
Implementation Details
The implementation phase of any project is the most important phase as it yields the
final solution, which solves the problem at hand. The implementation phase involves the
actual materialization of the ideas, which are expressed in the analysis document and
developed in the design phase. Implementation should be perfect mapping of the design
document in a suitable programming language in order to achieve the necessary final
product. Often the product is ruined due to incorrect programming language chosen for
implementation or unsuitable method of programming. It is better for the coding phase to
be directly linked to the design phase in the sense if the design is in terms of object
oriented terms then implementation should be preferably carried out in object oriented
way.
Main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/wall"
android:orientation="horizontal"
android:padding="85dip">
<LinearLayout
android:layout_width="249dp"
android:layout_height="250dp"
android:layout_gravity="center"
android:orientation="vertical">
<Button
android:id="@+id/new_button"
android:layout_width="200dp"
android:layout_height="55dp"
android:layout_margin="5dip"
android:background="@drawable/button1"
android:text="@string/new_game_label"
android:textAppearance="@android:style/TextAppearance.Material.Large"
android:textStyle="bold" />
<Button
android:id="@+id/about_button"
android:layout_width="200dp"
android:layout_height="55dp"
android:layout_margin="5dip"
android:background="@drawable/button1"
android:text="@string/about_label"
android:textAppearance="@android:style/TextAppearance.Material.Large"
android:textStyle="bold" />
<Button
android:id="@+id/exit_button"
android:layout_width="200dp"
android:layout_height="55dp"
android:layout_margin="5dip"
android:background="@drawable/button1"
android:text="@string/exit_label"
android:textAppearance="@android:style/TextAppearance.Material.Large"
android:textStyle="bold" />
<CheckBox
android:id="@+id/mus"
style="@android:style/Widget.DeviceDefault.Light.CompoundButton.CheckBox"
android:layout_width="200dp"
android:layout_height="40dp"
android:autoText="false"
android:onClick="onClick"
android:text="Music"
android:textAppearance="@android:style/TextAppearance.Material.Large"
android:textColor="#000000"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
5.3.2 Keypad.xml
import android.app.Activity;
import android.app.Dialog;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.text.style.BackgroundColorSpan;
import android.util.Log;
import android.view.Gravity;
import android.widget.Toast;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.d(TAG, "onCreate");
import java.util.Objects;
mus=findViewById(R.id.mus);
mySong = MediaPlayer.create(SudokuGame1.this,R.raw.dash);
mySong.setLooping(true);
}
// ...
public void onClick(View v) {
if(mus.isChecked()){
mySong.start();
}
else {
mySong.pause();
}
switch (v.getId()) {
case R.id.about_button:
Intent i = new Intent(this, About.class);
startActivity(i);
break;
// More buttons go here (if any) ...
case R.id.new_button:
openNewGameDialog();
break;
case R.id.exit_button:
finish();
break;
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.settings:
startActivity(new Intent(this, Prefs.class));
return true;
// More items go here (if any) ...
}
return false;
}
User Interface