You are on page 1of 22

Raj Kumar Goel Institute of Technology, Ghaziabad

Department of Computer Science & Engineering


(Internet Of Things)

HAND CRICKET
A Report submitted in partial fulfillment of the
requirement for the degree of

BACHELOR OF TECHNOLOGY
IN
COMPUTER SCIENCE AND ENGINEERING
(INTERNET OF THINGS)
Under the Supervision of
Mr. Virat Raj Saxena
By
Asmit Sachan (2100330130008)

Ayush Mishra (2100330130010)

Abhishek Kashyap (2100330130001)

Raj Kumar Goel Institute of Technology Ghaziabad


5t h KM. STONE, DELHI-MEERUT ROAD, GHAZIABAD (U.P)-201003
Department of Computer Science & Engineering
Raj Kumar Goel Institute of Technology, Ghaziabad

Department of Computer Science & Engineering


(Internet Of Things)
(Internet Of Things)
Session: - 2022-2023

CONTENTS

1. ABSTRACT ------------------------------------------------- 1

2. MODULE DESCRIPTION --------------------------------2

3. INTRODUCTION ------------------------------------------ 3

3.1 OBJECTIVE

3.2 SCOPE

3.3 FEASIBILITY STUDY

4. METHODODLOGY / PLANNING WORK ------------ 4

5. SOFTWARE / HARDWARE REQUIREMENTS-------5

6. CODING PART --------------------------------------------- 6

7. FUTURE SCOPE -------------------------------------------- 7

8. CONCLUSION ---------------------------------------------- -8

9. OUTPUT -------------------------------------------------------9

10. BIBLIOGRAPHY/REFERENCES ----------------------10


Raj Kumar Goel Institute of Technology, Ghaziabad

Department of Computer Science & Engineering


(Internet Of Things)

ABSTRACT

A new way to play the same old game. Hand cricket is a game played by many school kids
for fun. It uses the concepts of cricket and played with hands. Hand Cricket is a game in
which two players show scores on their respective fingers. If the scores are equal, the
batsman is declared out. Else, the score of the batsman is added to the total runs of the batting
team.
Hand Cricket will let you relive your past and provide you an enhanced experience with all
the different and innovative features. There are 30 different combinations of formats ranging
from 1 wicket and 1 over to 10 wickets and unlimited overs. This variety lets you choose and
play with your favourite settings. Don't like to bowl? The target feature lets you set a target
and play without bowling. There is something in it for everyone.
Playing this game is simple, fast, and convenient. Just tap as fast or as slow as you wish, and
the game would be played at your speed. You no longer have to wait for your friends to put a
number while they think! The scoreboard provides all the information you need to succeed.
From your score to the strike rates and averages, there are all the statistics you would want. A
cricketer's dream for real. Play with a lively experience and the touch of tapping a real button
with the haptic feedback which vibrates according to the number you play. Tapping is
definitely more fun now.
Earn coins after every match and get a lead on the leaderboard. Share your match results after
you complete playing to show your friends the nail-biting match you just played. Share your
match statistics with your friends and challenge them to do better than you! Share your
success with your friends on the leaderboard, and boast all about your success in this game.
Competition is everything so make sure to play more matches to get more coins.
The sleek design, the 3D effects, and the colorful yet soothing color schemes just for you to
enjoy looking at your screening. Hand Cricket supports full native dark mode on your device.
So play with the background that relaxes your eyes. Hand Cricket is currently free of charge
and doesn't support any advertisement so that you can have the best experience. A detailed
guide on how to play this game is provided for all of you who never got to play this creative
game back in school. It's all too easy so keep tapping.
Raj Kumar Goel Institute of Technology, Ghaziabad

Department of Computer Science & Engineering


(Internet Of Things)

MODULE DESCRIPTION

The modules of this project will be containing the different part which are stated
below :

❖ AsyncResult.java

❖ DownloadWebpageTask.java

❖ GameActivity.java

❖ MainActivity.java

❖ MenuActivity.java

❖ RegisterUserClass.java

❖ ScoreActivity.java

❖ Team.java

❖ TeamAdapter.java

❖ Toss2Activity.java

❖ TossActivity.java
Raj Kumar Goel Institute of Technology, Ghaziabad

Department of Computer Science & Engineering


(Internet Of Things)

INTRODUCTION

This game is a tribute to one of my favourite childhood games Hand Cricket. I


have played this game for more than a decade, and I am pretty sure everyone in
the Indian subcontinent would have heard or played this game at least once.
Playing this game in person required a lot of coordination as well as quick
mental math to keep track of runs and wickets, and did I mention that it was fun
to play? So to bring back those childhood memories, I have created the Hand
Cricket App. This game is just like how you used to play it but even better!
With the Hand Cricket app, you can do way more than just keeping track of
your score. You can find your strike rate, average, runs to win, coins, your rank,
and many more things. You also have a chance to be on the very prestigious
leaderboard top 50. You can also share your results, statistics, and your name on
the leaderboard with your friends! I have redefined the way people used to play
this game with their fingers before, compared to the way they play this game
with their fingers now
Making this game had its challenge as your opponent, computer, isn't as smart
as you. A computer could see the pattern of your numbers but couldn't possibly
predict the number you are going to put. For this reason, a coin system was
introduced so that users refrain from putting the same high scoring numbers like
5 and 6 to win the game. The coin system allowed us to penalize users for
putting the same high scoring number again and again. However, the game also
favors the users by rewarding them with more points when they mix the
numbers they put while batting and bowling. From playing it in real life to
playing it on your mobile, there is going to be a big difference because of the
lack of human element. But at the same time, users will experience a new
innovative way to play the same old game. I hope the fun remains and you get
the same joy while playing it on the app as when you used to play it with your
friends.
.​
Raj Kumar Goel Institute of Technology, Ghaziabad

Department of Computer Science & Engineering


(Internet Of Things)

DESIGN

These are some graphical designing modules:


Raj Kumar Goel Institute of Technology, Ghaziabad

Department of Computer Science & Engineering


(Internet Of Things)
METHADOLOGY/PLANNING WORK

The project was divided into three parts:


➢ Designing Development
➢ Logic and Algorithm Development
➢ Coding Module Development

The first plan of the work was to think of the game, then design the game. It takes 4 days to
complete the all the modules of the game design. There were total 9 module which was
design Arya Singh.

After the complete of the design module, we work on the logic and algorithm of the code of
game. Our all game was totally based on the logic and algorithm, Vishal created the logic and
algorithm of the game. All the modules are totally based on the algorithms and logic.

The main part was the coding part, all the codes were written in java in the platform Android
Studio. There are total 11 modules in this project, which are divide with it’s functions.

CODING PART

The coding part is divided in the modules of different functions, some are

❖ Main Activity
package com.shijin.oddoreven;

import android.app.*;
import android.os.*;
import android.view.*;
Raj Kumar Goel Institute of Technology, Ghaziabad

Department of Computer Science & Engineering


(Internet Of Things)
import android.view.View.*;
import android.widget.*;
import android.content.*;
import android.graphics.*;
import android.media.*;
import android.net.*;
import android.text.*;
import android.util.*;
import android.webkit.*;
import java.util.*;
import java.text.*;

public class MainActivity extends Activity {


private LinearLayout linear1;
private ImageView imageview1;
private TextView textview1;
private Timer _timer = new Timer();
private TimerTask splashtime;
private Intent menu = new Intent();

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
initialize();
initializeLogic();
}

private void initialize() {


linear1 = (LinearLayout) findViewById(R.id.linear1);
imageview1 = (ImageView) findViewById(R.id.imageview1);
textview1 = (TextView) findViewById(R.id.textview1);

imageview1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View _v) {

}
});

private void initializeLogic() {


splashtime = new TimerTask() {
@Override
public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
menu.setClass(getApplicationContext(), MenuActivity.class);
menu.setAction(Intent.ACTION_VIEW);
startActivity(menu);
finish();
}
});
}
Raj Kumar Goel Institute of Technology, Ghaziabad

Department of Computer Science & Engineering


(Internet Of Things)
};
_timer.schedule(splashtime, (int)(1500));
}
// created automatically
private void showMessage(String _s) {
Toast.makeText(getApplicationContext(), _s,
Toast.LENGTH_SHORT).show();
}

private int getRandom(int _minValue ,int _maxValue){


Random random = new Random();
return random.nextInt(_maxValue - _minValue + 1) + _minValue;
}

public ArrayList<Double> getCheckedItemPositionsToArray(ListView _list)


{
ArrayList<Double> _result = new ArrayList<Double>();
SparseBooleanArray _arr = _list.getCheckedItemPositions();
for (int _iIdx = 0; _iIdx < _arr.size(); _iIdx++) {
if (_arr.valueAt(_iIdx))
_result.add((double)_arr.keyAt(_iIdx));
}
return _result;
}

❖ Module 2

package com.shijin.oddoreven;

import android.app.*;
import android.os.*;
import android.view.*;
import android.view.View.*;
import android.widget.*;
import android.content.*;
import android.graphics.*;
import android.media.*;
import android.net.*;
import android.text.*;
import android.util.*;
Raj Kumar Goel Institute of Technology, Ghaziabad

Department of Computer Science & Engineering


(Internet Of Things)
import android.webkit.*;
import java.util.*;
import java.text.*;

public class TossActivity extends Activity {

private LinearLayout linear1;


private LinearLayout linear2;
private LinearLayout linear3;
private LinearLayout linear4;
private LinearLayout linear5;
private TextView textview1;
private ImageView imageview1;
private TextView textview2;
private ImageView imageview2;
private Button button1;
private Button button2;
private Button button3;
private Button button4;
private Button button5;
private Button button6;
private TextView textview3;
private TextView textview4;

private double x = 0;
private double y = 0;
private double z = 0;
private double num = 0;

private Timer _timer = new Timer();


private Intent toss2 = new Intent();
private TimerTask countdown;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.toss);
initialize();
initializeLogic();
}

private void initialize() {


linear1 = (LinearLayout) findViewById(R.id.linear1);
linear2 = (LinearLayout) findViewById(R.id.linear2);
linear3 = (LinearLayout) findViewById(R.id.linear3);
linear4 = (LinearLayout) findViewById(R.id.linear4);
linear5 = (LinearLayout) findViewById(R.id.linear5);
textview1 = (TextView) findViewById(R.id.textview1);
imageview1 = (ImageView) findViewById(R.id.imageview1);
textview2 = (TextView) findViewById(R.id.textview2);
imageview2 = (ImageView) findViewById(R.id.imageview2);
button1 = (Button) findViewById(R.id.button1);
button2 = (Button) findViewById(R.id.button2);
Raj Kumar Goel Institute of Technology, Ghaziabad

Department of Computer Science & Engineering


(Internet Of Things)
button3 = (Button) findViewById(R.id.button3);
button4 = (Button) findViewById(R.id.button4);
button5 = (Button) findViewById(R.id.button5);
button6 = (Button) findViewById(R.id.button6);
textview3 = (TextView) findViewById(R.id.textview3);
textview4 = (TextView) findViewById(R.id.textview4);

imageview1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View _v) {

}
});
imageview2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View _v) {

}
});
button1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View _v) {
x = 1;
y = getRandom((int)(1), (int)(6));
_ChangeImage2();
_ChangeImage();
_NextActivity();
}
});
button2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View _v) {
x = 2;
y = getRandom((int)(1), (int)(6));
_ChangeImage2();
_ChangeImage();
_NextActivity();
}
});
button3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View _v) {
x = 3;
y = getRandom((int)(1), (int)(6));
_ChangeImage();
_ChangeImage2();
_NextActivity();
}
});
button4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View _v) {
x = 4;
Raj Kumar Goel Institute of Technology, Ghaziabad

Department of Computer Science & Engineering


(Internet Of Things)
y = getRandom((int)(1), (int)(6));
_ChangeImage();
_ChangeImage2();
_NextActivity();
}
});
button5.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View _v) {
x = 5;
y = getRandom((int)(1), (int)(6));
_ChangeImage();
_ChangeImage2();
_NextActivity();
}
});
button6.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View _v) {
x = 6;
y = getRandom((int)(1), (int)(6));
_ChangeImage();
_ChangeImage2();
_NextActivity();
}
});

private void initializeLogic() {


num = 1;
}

private void _ChangeImage () {

if (x == 1) {
imageview2.setImageResource(R.drawable.imgw1);
}
if (x == 2) {
imageview2.setImageResource(R.drawable.imgw2);
}
if (x == 3) {
imageview2.setImageResource(R.drawable.imgw3);
}
if (x == 4) {
imageview2.setImageResource(R.drawable.imgw4);
}
if (x == 6) {
imageview2.setImageResource(R.drawable.imgw6);
}
if (x == 5) {
imageview2.setImageResource(R.drawable.imgw5);
}
}
private void _NextActivity () {
Raj Kumar Goel Institute of Technology, Ghaziabad

Department of Computer Science & Engineering


(Internet Of Things)
if (num == 1) {
num = num + 1;
z = Double.parseDouble(getIntent().getStringExtra("r"));
textview3.setText("Sum is");
textview4.setText(String.valueOf((long)(x + y)));
if (((x + y) % 2) == z) {
showMessage("You got the toss");
countdown = new TimerTask() {
@Override
public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
_Selectrole();
finish();
}
});
}
};
_timer.schedule(countdown, (int)(2000));
}
else {
showMessage("Android got the tose");
countdown = new TimerTask() {
@Override
public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
_Main();
finish();
}
});
}
};
_timer.schedule(countdown, (int)(2000));
}
}
else {

}
}
private void _ChangeImage2 () {

if (y == 1) {
imageview1.setImageResource(R.drawable.imgb1);
}
if (y == 2) {
imageview1.setImageResource(R.drawable.imgb2);
}
if (y == 3) {
imageview1.setImageResource(R.drawable.imgb3);
}
if (y == 4) {
imageview1.setImageResource(R.drawable.imgb4);
}
Raj Kumar Goel Institute of Technology, Ghaziabad

Department of Computer Science & Engineering


(Internet Of Things)
if (y == 5) {
imageview1.setImageResource(R.drawable.imgb5);
}
if (y == 6) {
imageview1.setImageResource(R.drawable.imgb6);
}
}
private void _Selectrole () {
toss2.setAction(Intent.ACTION_VIEW);
toss2.setClass(getApplicationContext(), Toss2Activity.class);
startActivity(toss2);
}
private void _Main () {
toss2.setAction(Intent.ACTION_VIEW);
toss2.setClass(getApplicationContext(), GameActivity.class);
toss2.putExtra("role", "2");
startActivity(toss2);
}

// created automatically
private void showMessage(String _s) {
Toast.makeText(getApplicationContext(), _s,
Toast.LENGTH_SHORT).show();
}

private int getRandom(int _minValue ,int _maxValue){


Random random = new Random();
return random.nextInt(_maxValue - _minValue + 1) + _minValue;
}

public ArrayList<Double> getCheckedItemPositionsToArray(ListView _list)


{
ArrayList<Double> _result = new ArrayList<Double>();
SparseBooleanArray _arr = _list.getCheckedItemPositions();
for (int _iIdx = 0; _iIdx < _arr.size(); _iIdx++) {
if (_arr.valueAt(_iIdx))
_result.add((double)_arr.keyAt(_iIdx));
}
return _result;
}

}
Raj Kumar Goel Institute of Technology, Ghaziabad

Department of Computer Science & Engineering


(Internet Of Things)
System Reqirement

❖ Hardware Requirement
• Hard disk: 40 GB
• RAM: 2 GB
• Processor: Pentium(R)Dual-core CPU

❖ Software Requirement

• Windows, Windows XP or above


• MacOS 10.12 or above
• Linux
• Ubuntu
Raj Kumar Goel Institute of Technology, Ghaziabad

Department of Computer Science & Engineering


(Internet Of Things)
OUTPUT

YOU ARE BATTING:


====================================
====================================
====================================
Enter Your Number: 3
Computer's Number: 1
**********
Your Current Score Is 3
**********
Enter Your Number: 4
Computer's Number: 5
**********
Your Current Score Is 7
**********
Enter Your Number: 7
Computer's Number: 4
**********
Your Current Score Is 7
**********
Enter Your Number: 2
Computer's Number: 1
**********
Your Current Score Is 9
**********
Enter Your Number: 1
Computer's Number: 3
**********
Your Current Score Is 10
**********
Raj Kumar Goel Institute of Technology, Ghaziabad

Department of Computer Science & Engineering


(Internet Of Things)
Enter Your Number: 6
Computer's Number: 3
**********
Your Current Score Is 16
**********
Enter Your Number: 5
Computer's Number: 5
**********

HOWZATTT!!!!!!
################
YOUR FINAL SCORE = 16
################
################
====================================
====================================
====================================
YOU ARE BOWLING:
====================================
====================================
====================================
Computer's Current Score Is 9
**********
Enter Your Number: 2
Computer's Number: 8
**********
THE COMPUTER HAS SCORED MORE THAN YOUU!!!
################
COMPUTER'S FINAL SCORE = 17
################
################
====================================
Raj Kumar Goel Institute of Technology, Ghaziabad

Department of Computer Science & Engineering


(Internet Of Things)
====================================
====================================
################
################
YOUR FINAL SCORE = 16
COMPUTER'S FINAL SCORE = 17
################
################

Sorry Vaibhav Singh, But The Computer Has Defeated You..!


====================================
Raj Kumar Goel Institute of Technology, Ghaziabad

Department of Computer Science & Engineering


(Internet Of Things)

CONCLUSION

In this modern world every thing is digital so we have made the hand cricket of children’s
online so that every can play this from anywhere anytime. Making this game had its
challenge as your opponent, computer, isn't as smart as you. A computer could see the pattern
of your numbers but couldn't possibly predict the number you are going to put. For this
reason, a coin system was introduced so that users refrain from putting the same high scoring
numbers like 5 and 6 to win the game. The coin system allowed us to penalize users for
putting the same high scoring number again and again. However, the game also favors the
users by rewarding them with more points when they mix the numbers they put while batting
and bowling. From playing it in real life to playing it on your mobile, there is going to be a
big difference because of the lack of human element. But at the same time, users will
experience a new innovative way to play the same old game. I hope the fun remains and you
get the same joy while playing it on the app as when you used to play it with your friends.

REFERENCE

❖ https://www.youtube.com/c/CodeWithHarry

❖ https://www.youtube.com/watch?v=4BD3y0NYNqk
Raj Kumar Goel Institute of Technology, Ghaziabad

Department of Computer Science & Engineering


(Internet Of Things)
Raj Kumar Goel Institute of Technology, Ghaziabad

Department of Computer Science & Engineering


(Internet Of Things)

Declaration

This is to certify that Mini Project Entitled “HAND CRICKET GAME” which is submitted
in
partial fulfillment of the requirement for the award of degree B.Tech. in Computer Science
and
Engineering to R.K.G.I.T, Ghaziabad, Dr. A.P.J. Abdul Kalam Technical University, Lucknow
comprises only original work and studies carried out by students himself. The matter
embodied
in this synopsis has not been submitted for the award of any other degree.

Date: 7 December 2022

Approved By : Signature

Mr. Virat Raj Saxena


MiniProject
CSE(IOT) Department
RKGIT, Ghaziabad

Counter sign By : Signature

Dr. Ramendra Singh


HOD, CSE(IOT) Department
RKGIT, Ghaziabad
Raj Kumar Goel Institute of Technology, Ghaziabad

Department of Computer Science & Engineering


(Internet Of Things)

FLOWCHART

You might also like