You are on page 1of 27

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

JNANA SANGAMA, BELAGAVI – 590 018

A Mini Project Report on

ROCK PAPER SCISSORS APPLICATION


Submitted in partial fulfillment of the requirements as a part of the

Mobile Application Development Laboratory with


Mini Project (18CSMP68)

For the award of degree of


Bachelor of Engineering
in
Information Science and Engineering
1RN20IS086 1RN20IS092
Submitted by 1RN20IS094
Medhini K Shetty Namratha UK Neha B A

Under the Guidance of


o SK
Ms. Poornima S M
ssor
Assistant Professor
Dept. of ISE, RNSIT

Department of Information Science and Engineering


RNS Institute of Technology
Channasandra, Dr. Vishnuvardhan Road, RR Nagar Post,
Bengaluru – 560 098
2022 -2023
RNS Institute of Technology
Channasandra, Dr. Vishnuvardhan Road, RR Nagar
Post,Bengaluru – 560 098

DEPARTMENT OF INFORMATION SCIENCE & ENGINEERING

CERTIFICATE
This is to certify that the mini project report entitled ROCK PAPER SCISSOR ANDROID
APPLICATION has been successfully completed by MEDHINI K SHETTY bearing USN
1RN20IS086, NAMRATHA UK bearing USN 1RN20IS092 and NEHA B A bearing USN
1RN20IS094 , presently VI semester students of RNS Institute of Technology in partial
fulfillment of the requirements as a part of the Mobile Application Development Laboratory
(18CSMP68) for the award of the degree of Bachelor of Engineering in Information Science
and Engineering under Visvesvaraya Technological University, Belagavi during academic
year 2022 – 2023. It is certified that all corrections/suggestions indicated for Internal Assessment
have been incorporated in the report and deposited in the departmental library. The mini project
report has been approved as it satisfies the academic requirements as a part of Mobile
Application Development Laboratory.

Ms. Poornima S M Dr. Suresh L


Coordinator Professor and HoD
Assistant Professor

External Viva

Name of the Examiners Signature with date

1.

2.
ABSTRACT

Rock-paper-scissors, also known as stone-paper-scissors, is a hand game that is commonly played


between two players. It is a simple game that doesn't require any equipment other than your hands.
The rules are straightforward:
Each player simultaneously forms one of three shapes with their hand: rock (a closed fist), paper
(an open hand), or scissors (a fist with the index and middle finger extended).
 Rock beats scissors (rock smashes scissors).
 Scissors beats paper (scissors cut paper).
 Paper beats rock (paper covers rock).
If both players choose the same shape, it is a tie, and the game is replayed.
Rock-paper-scissors is often used to settle disputes or make quick decisions. It is a popular game
among children because it's easy to learn and play. It can also be played competitively by adults,
and there are even international rock-paper-scissors tournaments held around the world.

Key features of the Rock Paper Scissor mobile application include:


• Multiplayer mode: Play with friends or other online players in real-time matches for upto 2
players.
• Single-player mode: Play against computer-controlled opponents with random choice.
• Realistic random choice: Experience the excitement of random choice virtually with
realistic animations.
• Customization options: Customize the appearance of the board, game pieces, and dice.
• Game statistics: Displays player performance along with win-loss statistics.

Throughout the development process, Android Studio's built-in tools, such as the layout editor and
debugging capabilities, are utilized to enhance productivity and ensure a smooth user experience.
Adhering to Android's design principles, the application prioritizes responsiveness, performance,
and compatibility across a wide range of Android devices.

iv
ACKNOWLEDGMENT

The fulfillment and rapture that go with the fruitful finishing of any assignment would be inadequate
without the specifying the people who made it conceivable, whose steady direction and support
delegated the endeavors with success.

We would like to profoundly thank the Management of RNS Institute of Technology for providing
such a healthy environment to carry out this Mobile Application Development Laboratory with Mini
Project Work.

We would like to express our thanks to our Principal Dr. Ramesh Babu H S for his support and
inspired us towards the attainment of knowledge.

We wish to place on record our words of gratitude to Dr. Suresh L, Professor and Head of the
Department, Information Science and Engineering, for being the enzyme and master mind behind
our Mobile Application Development Laboratory with Mini Project Work.

We would like to express our profound and cordial gratitude to my Mini Project Coordinators, Ms.
Poornima S M, Assistant Professor, Department of Information Science and Engineering for their
valuable guidance, constructive comments, continuous encouragement throughout the Mini Project
Work and guidance in preparing report.

We would like to thank all other teaching and non-teaching staff of Information Science &
Engineering who have directly or indirectly helped us to carry out the Mini Project Work.

Also, we would like to acknowledge and thank our parents who are source of inspiration and
instrumental in carrying out this Mini Project Work.

Place: Bengaluru
Date: 19/06/2023

Medhini K Shetty Namratha UK Neha B A


1RN20IS086 1RN120IS092 1RN20IS089

iv
TABLE OF CONTENTS
CERTIFICATE ii
ABSTRACT iii
ACKNOWLEDGMENT iv
TABLE OF CONTENTS v
LIST OF FIGURES vi
ABBREVATIONS vii
1. INTRODUCTION 8
1.1. Introduction to android 8

1.2. History 8

1.3. Android versions 9

1.4. Architecture of Android 10

1.5. Android Studio Installation 12

2. INTRODUCTION TO PROJECT 13

2.1. Overview of The Project 13

2.2. Aim of the project 13

3. SYSTEM DESIGN 14
3.1 System requirement 14
3.2 User interface 14

4. IMPLEMENTATION 18
4.1 About Android Studio 18
4.2 XML 18
4.3 Java codes 19
5. TESTING 23
5.1 Test cases 23
6. RESULT 24
7. CONCLUSION AND ENHANCEMENT 26
8. REFERENCES 27
vii
LIST OF FIGURES

Fig. No Fig. Name Page


No.
1.1 Different Android Versions 9

1.2 Architecture of android OS 10

1.3 Starting Android Studio 12

3.1 XML code for creating home page 14

3.2 XML code for instruction 15

3.3 Design for instruction 15

3.4 XML code for multiplayer 16

3.5 Design for multiplayer 16

3.6 XML for winner against computer 17

4.1 Java code for random generation 17

4.2 Java code for multiplayer 19

4.3 Java code for winner with computer 20

4.4 Java code for winner in multiplayer 21

5.1 Tables for test cases 22

6.1 Step1 23

6.2 Step2 24

6.3 Step3 24

6.4 Step4 25

25

vii
ABBREVATIONS

OS Operating System

UI User Interface

MCQ Multiple Choice Question

RAM Random Access Memory

JDK Java Development Kit

SDK Software Development Kit

API Application Program Interface

XML Extensible Markup Language

IDE Integrated Development


Environment

vii
Chapter 1

INTRODUCTION
1.1 Introduction to Android
Android is a software platform and operating system for mobile devices. Android is
available as open source. It allows developers to write managed code in Java Language,
controlling the device via Google-developed Java libraries.
Android is a Linux based operating system and it was bought by Google in 2007.There
are tons of application available and one of the prime reasons for this vast number is
android being an open source. On the other hand, android based device like mobile, tab is
very user friendly. A survey has done by ―Light Castle Partners‖ research wing which
indicates that though other operating system mobile users exist but the majority users are
goes with android operating system.

1.2 History

The history and versions of android are interesting to know. The code names of android
ranges from A to J currently, such as Astro, Blender, Cupcake, Donut, Eclair, Froyo,
Gingerbread, Honeycomb, Ice Cream Sandwich, Jelly Bean, KitKat, and Lollipop. Let us
understand the android history in a sequence.

 Initially, Andy Rubin founded Android Incorporation in Palo Alto, California, United
States in October, 2003.In 17th August 2005, Google acquired android Incorporation.
Since then, it is in the subsidiaryof Google Incorporation.

 The key employees of Android Incorporation are Andy Rubin, Rich Miner, Chris
White and Nick Sears.

 Originally intended for camera but shifted to smart phones because of low market
forcamera only. Android is the nick name of Andy Rubin given by coworkers
because of his love to robots.

 In 2007, Google announces the development of android OS. In 2008, HTC launched
the first android mobile.

Dept. of ISE, RNSIT 2022-2023 Page 8


18CSMP68: Mobile Application Development with Mini Project Rock Paper Scissors App
App
ainder App
1.3 Android versions
1.1

Fig 1.1: Different Android Versions

Dept. of ISE, RNSIT 2022-2023 Page99


18CSMP68: Mobile Application Development with Mini Project Rock Paper Scissors App
App
ainder App
1.4 Architecture of Android

The skeleton of Android framework and its constituents are shown in the following figure:

Fig 1.2: Architecture of android OS

1.4.1Applications Layer

Android ships with a set of core applications including an email client, SMS
program, calendar, maps, browser, contacts and others. All applications are built
using the Java.

1.4.2 Application Framework Layer

The next layer is the application framework. This includes the programs that
manage the phone’s basic functions telephone applications, switching between
processes and keeping track of the phone's physical location. Application
developers have full access to Android's application framework.

1.4.3 Libraries Layer

The next layer contains the native libraries of Android. These shared libraries are
all written in C or C++, compiled for the particular hardware architecture used
by the phone and preinstalled by the phone vendor.

Dept. of ISE, RNSIT 2022-2023 Page10


10
18CSMP68: Mobile Application Development with Mini Project Rock Paper Scissors App

1.4.4 Android Runtime Layer

Android Runtime layer includes Dalvik Virtual Machine (DVM) and a set of core
java libraries. Every Android app gets its own instance of DVM. Dalvik has 14
been written so that a device can run multiple virtual machines efficiently and it
executes files with .dex (Dalvik Executable Format) extension optimized for
minimum memory.

1.4.5 Activity

An Activity is, fundamentally, an object that has a lifecycle. An Activity is a chunk


of code that does some work, as necessary. The work can include displaying a UI to
the user, though it doesn't have to as some Activities never display UIs. Typically,
we designate one of our application's Activities as the entry point to our
application.

1.4.6 Broadcast Receiver

Broadcast Receiver is yet another type of component that can receive and respond
to any of the broadcast announcements.

1.4.7 Service

A Service is a body of code that runs in the background. It can run in its own
process, or in the context of another application's process, depending on its needs.
Other components "bind" to a Service and invoke methods on it via remote
procedure calls. A Service keeps the music going even when the UI has completed.

1.4.8 Content Provider

Content Provider is data storehouse that provides access to data on device, the
classic example is Content Provider used to access the user's list of contacts. Our
application can access data that applications have exposed via a Content
Provider, and can also define our own Content Providers to expose data of own.

Dept. of ISE, RNSIT2022-2023 Page1111


18CSMP68: Mobile Application Development with Mini Project Rock Paper Scissors App

1.5 Android Studio Installation Install Android Studio


Setting up Android Studio takes just a few clicks.

First, be sure you download the latest version of Android Studio.

1.5.1 Windows

To install Android Studio on Windows, proceed as follows:

If you downloaded an .exe file (recommended), double-click to launch it.


If you downloaded a .zip file, unpack the ZIP, copy the android-studio folder into
your Program Files folder, and then open the android-studio > bin folder and launch
studio64.exe (for 64-bit machines) or studio.exe (for 32-bit machines).

Follow the setup wizard in Android Studio and install any SDK packages that it
recommends. That's it. The following video shows each step of the setup
procedure when using therecommended .exe download.

As new tools and other APIs become available, Android Studio tells you with a
pop-up, or you can check for updates by clicking Help > Check for Update.

Fig 1.3: Starting Android Studio

Dept. of ISE, RNSIT 2022-2023 12


Page 12
Chapter 2
INTRODUCTION TO PROJECT

2.1 Overview of The Project


 This project report provides an overview of a simple Rock paper scissor game
developed using Android Studio.

 Rock paper scissor is a popular board game played by 2 players, and this project
aims to recreate the game's mechanics and functionalities in a mobile application.

 The Rock paper scissor app is a mobile application that brings the classic game of
Rock paper scissor to your fingertips.

2.2 Aim of The Project

 Designed for Android devices, this app provides a convenient and immersive way
to enjoy the timeless fun of Rock Paper Scissor with friends and family. Whether
you want to relive nostalgic memories or discover the game for the first time, the
Rock Paper Scissor app offers an engaging and entertaining gaming experience.

 Unlike the physical game, which requires setting up the board, gathering players,
and finding a suitable playing space, the Rock Paper Scissor app offers the
convenience of accessing the game anytime, anywhere, directly on your Android
device. This accessibility makes it easy for players to indulge in a quick game of
Rock Paper Scissor during spare moments or when they are on the go.

 The app's user-friendly interface enhances the overall gaming experience. The
intuitive controls and visually appealing design make it easy for players to
navigate through the app, select moves. This simplicity allows players, whether
they are familiar with Rock Paper Scissor or not, to quickly grasp the play
mechanics and start enjoying the game without any confusion

Dept. of ISE, RNSIT 2022-2023 Page 13


13
18CSMP68: Mobile Application Development with Mini Project Rock Paper Scissors app

Chapter 3
SYSTEM DESIGN
3.1 System Requirements

3.1.1 Hardware Requirements:


 RAM: GB or more
 Hard Disk: 8GB or more
 Processor: Pentium IV or above

3.1.2 Software Requirements:


 Operating System: Windows 7 or above
 IDE: Android Studio 2022.2.1
 API Level: 19 or above

3.2 User Interface


 Home Page

Fig 3.1: XML code for creating the home page

Dept. of ISE, RNSIT 2022-2023 Page 14


18CSMP68: Mobile Application Development with Mini Project Rock Paper Scissors app

• Instruction

Fig 3.2: XML code for the display of instructions.

Fig 3.3: Design for instruction

Dept. of ISE, RNSIT 2022-2023


Page 15
18CSMP68: Mobile Application Development with Mini Project Rock Paper Scissors app

Multiplayer game

Fig 3.4: XML code for multiplayer

Fig 3.5: Design for multiplayer

Dept. of ISE, RNSIT 2022-2023


Page 16
18CSMP68: Mobile Application Development with Mini Project Rock Paper Scissors app

• Winner with computer

Fig 3.6: XML for winner against computer.

Fig 3.7: Design for winner against computer

Dept. of ISE, RNSIT 2022-2023 Page 17


18CSMP68: Mobile Application Development with Mini Project Rock Paper Scissors App
Chapter 4
IMPLEMENTATION
Implementation is the carrying out, execution, or practice of a plan, a method, or any
design, idea, model, specification, standard or policy for doing something. As such,
implementation is the action that must follow any preliminary thinking in order for
something to actually happen.

4.1 About Android Studio


Android Studio is the official integrated development environment for Google's Android
operating system, JetBrains' IntelliJ IDEA software and designed specifically for Android
development. It is available for download on Windows, macOS and Linux based os. It is
a replacement for Eclipse Android Development Tools (E-ADT) as the primary IDE for
native Android application development.

4.1.1 Features of Android Studio


 Gradle-based build support
 Android-specific refactoring and quick fixes
 Lint tools to catch performance, version compatibility and other problems
 ProGuard integration and app-signing capabilities
 Template-based wizards to create common Android designs and components
 A rich layout editor that allows users to drag-and-drop UI components, option to
preview layouts on multiple screen configurations[17]
 Support for building Android Wear apps
 Built-in support for Google Cloud Platform, enabling integration with Firebase
Cloud Messaging and Google App Engine[18]

4.2 XML
The Extensible Markup Language (XML) is a simple text-based format for representing
structured information: documents, data, configuration, transactions, invoices, and much
more. It was derived from older standard format called SGML order to be more suitable
for Web use.

Dept. of ISE, RNSIT 2022-2023 19 18


Page
18CSMP68: Mobile Application Development with Mini Project Rock Paper Scissors App
Extensible Markup Language (XML) is a markup language and file format for storing,
transmitting, and reconstructing arbitrary data. It defines a set of rules for encoding
documents in a format that is both human-readable and machine-readable. The World
Wide Web Consortium's XML 1.0 Specification[2] of 1998[3] and several other related
specifications[4]—all of them free open standards—define XML.[5].

4.3 Java Codes

4.3.1 Play with computer fragment:

 String[] selections = {"rock", "paper", "scissor"}; declares an array called


selections and initializes it with three strings representing the available options for
selection: "rock", "paper", and "scissor".
 Random random = new Random(); creates an instance of the Random class,
which will be used to generate random numbers.
 int index = random.nextInt(selections.length); generates a random integer between
0 (inclusive) and the length of the selections array (exclusive) using the nextInt
method of the Random class. This random integer will be used as an index to
select a random element from the selections array.
 return selections[index]; retrieves the element from the selections array at the
randomly generated index and returns it as the result of the getRandomSelection
method.

Fig 4.1: Java code for random move generation

Dept. of ISE, RNSIT 2022-2023 Page1919


18CSMP68: Mobile Application Development with Mini Project Rock Paper Scissors App

4.3.2 Play with others fragment

 private void onPlayP1(String selection): This method is called when


player 1 makes a selection. The selection parameter represents the choice
made by player 1.
 if (allowPlaying): Checks if playing is allowed. If playing is allowed, the
code inside the if statement will be executed.
 binding.ivIconP1.setImageResource(R.drawable.check);: Sets the image
resource of ivIconP1 to a check mark image, indicating that player 1 has
made a selection.
 binding.tvP1Status.setText("Ready");: Sets the text of tvP1Status to
"Ready", indicating that player 1 is ready.
 selectionP1 = selection;: Stores the selection made by player 1 in the
selectionP1 variable.

Fig 4.2: Java code for multiplayer game

Dept. of ISE, RNSIT 2022-2023 19 20


Page
18CSMP68: Mobile Application Development with Mini Project Rock Paper Scissors App

4.3.3 Winner with computer


 The FinishComp class is an activity that displays the result of a
competition.
 It retrieves the winner information from the intent, sets the
appropriate view based on the winner ("comp" or not), and
provides a button to return to the home screen.
 The view is updated with an image and text message indicating
whether the player won or lost.

Fig 4.3: Java code for winner with computer

4.3.4 Winner against multiplayer

 The onCreate() method is overridden, which called when activity


is being created.
 It initializes the activity sets layout calling setContentView which
associates activity with XML layout.
 The activity contains a button and TextView. The button with the
id btnHome is obtained using findViewById(), which finds view
based on resource id. The Text View with id player Name is also
obtained in the same way.

Dept. of ISE, RNSIT 2022-2023 Page1921


18CSMP68: Mobile Application Development with Mini Project Rock Paper Scissors App

 A click listener is set on the btnHome button using the lambda


expression view -> This listener defines the behavior when the
button is clicked.
 Inside the click listener, an Intent is created to navigate back to
the MainActivity class. The Intent takes a current context and
the target activity class as parameters.
 The start Activity method is called to start MainActivity and
finish() is called to finish and close the current FinishActivity.

Fig 4.4: Java code for winner in multiplayer

Dept. of ISE, RNSIT 2022-2023 19 22


Page
18CSMP68: Mobile Application Development with Mini Project Rock Paper Scissors App

Chapter 5

TESTING
Software testing in an essential phase in the development life cycle of an application.
Testing ensures that the developed system meets its functional and non-functional
requirements. Two important terms in software testing are Verification and Validation.
Verification is the process of evaluating work-products like requirement specs, design
specs and test cases etc. of different development phases to make sure that they meet the
requirements for that phase. It ensures that the system is built in the right way. Whereas
Validation is the process of evaluating the software at the end of the development phase to
make sure that it meets the business requirements. It is used to make sure that the product
fulfils its intended use and that the end product is built right. One of the most important
tools to test and debug an Android app is the Dalvik debug monitor server (DDMS) that is
part of the Android framework. DDMS helps you to debug your code as it prints errors,
warning and other information from your code. It also provide stack traces for exceptions
on the Logcat output. Various other testing strategies have been adopted to make sure the
correctness of the Image Steganography app. They are discussed in this chapter.

5.1 Test Cases

Sl. Test Case Action Result


No.
1 On tapping screen at the start. The game will start and user can Pass
start playing it.
2 Once the winner is decided. The score board should be Pass
updated.
3 On pressing start button. The game should start. Pass
4 On selecting a move. The winner should be decided Pass
from set of rules.
5 On opting for an option. (Rock, The moves should be visible on Pass
Paper, or Scissor) the screen.
6 Once the matching criteria gets over. The game must update the score. Pass
7 Both players choose same move. Should display tie and the game Fail
should be replayed.
Table 5.1: Test cases

Dept. of ISE, RNSIT 2022-2023


Page 23
18CSMP68: Mobile Application Development with Mini Project Rock Paper Scissors App
Chapter 6

RESULTS

Step 1: The game will start at a point when we enter the home screen and we get
different options to play the game for eg: Rock, Paper, Scissors.

Fig 6.1: Step 1

Step 2: To know the rules and regulations of the game we click on the see the
instructions (at the bottom) we will come to know about the instructions.

Fig 6.2: Step 2

Step 3: When we will choose an option (for eg: rock and the system chooses
Scissors then the player 1 will get the point and it will be updated in
the Scoreboard with a star and vice-versa).

Dept. of ISE, RNSIT 2022-2023


Page 24
18CSMP68: Mobile Application Development with Mini Project Rock Paper Scissors App

Fig 6.3: Step 3

Step 4: After playing certain rounds in a best of 3 format you will get your result
(win or lose).

Fig 6.4: Step 4

Dept. of ISE, RNSIT 2022-2023


Page 25
18CSMP68: Mobile Application Development with Mini Project Rock Paper Scissors App

Chapter 7
CONCLUSION AND ENHANCEMENT

7.1Conclusion

Our app provides a modern and user-friendly interface, making it accessible to players
of all ages and skill levels. The intuitive design allows users to easily navigate through
the game, select their desired play mode, and start enjoying the classic Rock Paper
Scissors challenge.
One of the unique features of our app is the inclusion of different game modes.
Whether you want to play against the computer, challenge your friends in multiplayer
mode, or compete with players from around the world online, our app caters to all
these preferences. This versatility adds a new level of excitement and variety to the
traditional game, keeping users engaged and entertained.

7.2 Future work


 Expanded Game Modes: Introduce additional game modes to provide more variety
and challenges.
 Social Features: Implement social features that enable users to connect with friends,
challenge them to matches, or share their achievements on social media platforms.
Leaderboards can be added to foster competition and create a sense of community
among players.
 In-App Rewards and Achievements: Introduce a reward system where users can earn
virtual currency or unlock achievements for completing specific milestones or
winning consecutive matches.
 Multiplayer Enhancements: Improve the multiplayer experience by enabling real-
time online matches with players from around the world. Incorporate matchmaking
algorithms to ensure fair matchups based on skill level or create a lobby system
where players can join or create their own rooms for private matches.
 Augmented Reality (AR) Integration: Explore the possibility of integrating
augmented reality technology to bring the Rock Paper Scissors gameplay into the
real world. Users could play the game using their device's camera and have virtual
hands mimic their own gestures, creating an immersive and interactive experience.
 Cross-Platform Compatibility: Develop versions of the app for other platforms such
as iOS or web browsers, allowing users to play the game across different devices.

Dept. of ISE, RNSIT 2022-2023 26


Page 26
18CSMP68: Mobile Application Development with Mini Project Rock Paper Scissors App

Chapter 8

REFERENCES

 www.geekforgeeks.com
 www.stackover.com
 www.javapoint.com
 www.tutorials.com
 https://developer.android.com
 https://www.edureka.co
 https://www.tutlane.com
 https://www.androidauthority.com
 https://en.wikipedia.org/wiki/Android_Studio
 https://developers.google.com/admob/android/quick-start
 https://www.quora.com/What-is-the-recommended-hardware-for-Android-Studio
 https://source.android.com
 https://www.kindacode.com

Dept. of ISE, RNSIT 2022-2023 27

You might also like