0% found this document useful (0 votes)
16 views13 pages

Mad Report

The Rock Paper Scissors game is an Android application that allows users to play against a computer, enhancing programming skills in Java and Android development. It teaches game logic, user input handling, and randomness through a simple yet engaging interface. The project serves as a foundation for more complex game development and reinforces fundamental programming concepts.

Uploaded by

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

Mad Report

The Rock Paper Scissors game is an Android application that allows users to play against a computer, enhancing programming skills in Java and Android development. It teaches game logic, user input handling, and randomness through a simple yet engaging interface. The project serves as a foundation for more complex game development and reinforces fundamental programming concepts.

Uploaded by

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

Rock Paper Scissors Game

2024-25
EMI CalculatorEMI Calculator EMI
Ca
Title: - The Rock Paper Scissors Game

1. Rational: -
The Rock Paper Scissors game is a classic hand game played between two players. In this Android
version, users can play against the computer, which generates random choices. The game is designed to be
simple yet engaging, helping users understand basic game logic, conditional statements, and randomness in
programming.
By developing this project, developers gain experience in Java programming, Android Studio
development, and implementing game logic using XML and Java. The project reinforces fundamental
programming concepts like user input handling, conditional statements, loops, and random number
generation. It serves as a stepping stone to more complex Android game development and enhances
problem-solving skills.

2. Aims/Benefits of the Micro-Project: -

 Understanding Game Logic Implementation


 Enhancing Android Development Skills
 Developing Interactive Mobile Applications
 Foundation for More Complex Game Development

3. Course Outcomes: -
 Interprete features of Android operating system.
 Configure Android environment and development tools.
 Develop rich user interface using layouts and controls.
 Use User Interface components for android application development.

Sharad Institute of Technology Polytechnic, Yadrav. Page 1


Rock Paper Scissors Game
EMI CalculatorEMI Calculator EMI
2024-25

Ca
4. Literature Review: -
Rock Paper Scissors is a widely known game with simple yet strategic mechanics. Studies show that
introducing randomness into a game enhances user engagement. Many beginner programmers use this game
to understand AI-generated decisions and probability-based outcomes. The use of Android Studio and Java
makes the game more interactive and mobile-friendly. Research indicates that implementing basic games
like this enhances coding skills and provides insight into event-driven programming.

5. Actual Methodology Followed: -


1. Decided the topic.
2. I collected information.
3. Took guidance from our guide.
4. Then I will start to create the project for topic.
5. At first, I will arrange this information as per instructions.
6. Then I will prepare a report on the topic.
7. I will present it to my guide and ask him for the queries.
8. I will make changes as per the guidance.
9. Will make my final project.
10. Submit it to my guide.

Sharad Institute of Technology Polytechnic, Yadrav. Page 2


Rock Paper Scissors Game
EMI CalculatorEMI Calculator EMI
2024-25

Ca
6. Actual Resources Used: -

Sr.No NameofResources Specification Quantity Remark


1) ComputerSystem processor - 11th 1 It Is used to
Gen Intel(R) Core Performs
(TM) i5-1135G7 @ project
2.40GHz 2.42 related task.
GHz
2) Operating System Windows 11 1 It Is used to
Performs
project
related task.
3) Software Android studio 1 It Is used to
develop
android
application

Sharad Institute of Technology Polytechnic, Yadrav. Page 3


Rock Paper Scissors Game
EMI CalculatorEMI Calculator EMI
2024-25

Ca
7. introduction :-
Rock Paper Scissors is a simple game where a player selects one of three options: Rock, Paper, or Scissors.
The computer also selects an option randomly, and the winner is determined based on predefined rules:

 Rock beats Scissors

 Scissors beats Paper

 Paper beats Rock If both the player and the computer choose the same option, it results in a draw.
This project implements the game using Java and provides an interactive Android application for
better user experience.

8. Working of Game
Input Parameters:

 User selects Rock, Paper, or Scissors through the Android interface.


 The computer randomly generates a choice.

Process:

 The program compares the user's choice with the computer's choice.
 The winner is determined based on the game rules.
 The result is displayed on the Android application.

Output:

 Displays the selected choices of both the user and the computer.
 Declares the winner or states if the game is a draw.

Features:

 Simple and interactive UI using XML layouts.


 Randomized computer choices for fairness.
 Instant result display with animations.

Sharad Institute of Technology Polytechnic, Yadrav. Page 4


Rock Paper Scissors Game
EMI CalculatorEMI Calculator EMI
2024-25

Ca
Prpgram:

XML Layout (activity_main.xml):

<?xml version="1.0" encoding="utf-8"?>


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#032E33"
android:gravity="center"
android:orientation="vertical"
android:padding="20dp">

<TextView
android:id="@+id/tvResult"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:fontFamily="sans-serif-smallcaps"
android:text="Let's Play!"
android:textColor="@android:color/white"
android:textSize="34sp" />

<View
android:id="@+id/view2"
android:layout_width="279dp"
android:layout_height="103dp" />

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
Sharad Institute of Technology Polytechnic, Yadrav. Page 5
Rock Paper Scissors Game
EMI CalculatorEMI Calculator EMI
2024-25

Ca<ImageView
android:id="@+id/imgPlayerChoice"
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/rock" />

<TextView
android:layout_width="100px"
android:layout_height="100px"
android:layout_margin="10dp"
android:text="VS"
android:textColor="@android:color/white"
android:textSize="24sp" />

<ImageView
android:id="@+id/imgComputerChoice"
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/rock" />
</LinearLayout>

<TextView
android:id="@+id/tvScore"
android:layout_width="373dp"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:fontFamily="monospace"
android:gravity="center"
android:text="Wins: 0 Losses: 0 Ties: 0"
android:textColor="@android:color/white"
android:textSize="18sp" />

Sharad Institute of Technology Polytechnic, Yadrav. Page 6


Rock Paper Scissors Game
EMI CalculatorEMI Calculator EMI
2024-25

Ca
<View
android:id="@+id/view3"
android:layout_width="361dp"
android:layout_height="111dp" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:gravity="center"
android:orientation="horizontal">

<ImageButton
android:id="@+id/btnRock"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="@null"
android:contentDescription="Rock"
android:scaleType="fitCenter"
android:src="@drawable/rock" />

<ImageButton
android:id="@+id/btnPaper"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginLeft="70px"
android:layout_marginRight="70px"
android:background="@null"
android:contentDescription="Paper"
android:scaleType="fitCenter"
android:src="@drawable/paper" />

Sharad Institute of Technology Polytechnic, Yadrav. Page 7


Rock Paper Scissors Game
EMI CalculatorEMI Calculator EMI
2024-25

Ca<ImageButton
android:id="@+id/btnScissors"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="@null"
android:contentDescription="Scissors"
android:scaleType="fitCenter"
android:src="@drawable/scizor" />
</LinearLayout>

</LinearLayout>

Sharad Institute of Technology Polytechnic, Yadrav. Page 8


Rock Paper Scissors Game
EMI CalculatorEMI Calculator EMI
2024-25

Ca
Java Code (MainActivity.java):

package com.example.san12;

import android.os.Bundle;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import java.util.Random;

public class MainActivity extends AppCompatActivity


{ TextView tvResult, tvScore;
ImageView imgPlayerChoice, imgComputerChoice;
ImageButton btnRock, btnPaper, btnScissors;

String[] choices = {"Rock", "Paper", "Scissors"};


int winCount = 0, lossCount = 0, tieCount = 0;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

tvResult = findViewById(R.id.tvResult);
tvScore = findViewById(R.id.tvScore);
imgPlayerChoice = findViewById(R.id.imgPlayerChoice);
imgComputerChoice = findViewById(R.id.imgComputerChoice);
btnRock = findViewById(R.id.btnRock);

btnPaper = findViewById(R.id.btnPaper);

Sharad Institute of Technology Polytechnic, Yadrav. Page 9


Rock Paper Scissors Game
EMI CalculatorEMI Calculator EMI
2024-25

Ca btnScissors = findViewById(R.id.btnScissors);

btnRock.setOnClickListener(v -> playGame("Rock"));


btnPaper.setOnClickListener(v -> playGame("Paper"));
btnScissors.setOnClickListener(v -> playGame("Scissors"));
}

private void playGame(String userChoice) {


String computerChoice = choices[new Random().nextInt(3)];

// Set player choice image


imgPlayerChoice.setImageResource(getImageResource(userChoice));

// Set computer choice image with fade-in animation


imgComputerChoice.setImageResource(getImageResource(computerChoice));
imgComputerChoice.setAlpha(0f);
imgComputerChoice.animate().alpha(1f).setDuration(500);

String result;
if (userChoice.equals(computerChoice))
{ result = "It's a Tie!";
tieCount++;
} else if ((userChoice.equals("Rock") && computerChoice.equals("Scissors")) ||
(userChoice.equals("Scissors") && computerChoice.equals("Paper")) ||
(userChoice.equals("Paper") && computerChoice.equals("Rock"))) {
result = "You Win!"; winCount+
+;
} else {
result = "You Lose!"; lossCount+
+;
}

Sharad Institute of Technology Polytechnic, Yadrav. Page 10


Rock Paper Scissors Game
EMI CalculatorEMI Calculator EMI
2024-25

Ca tvResult.setText(result);

tvScore.setText("Wins: " + winCount + " Losses: " + lossCount + " Ties: " + tieCount);
}

private int getImageResource(String choice)


{ switch (choice) {
case "Rock": return R.drawable.rock;
case "Paper": return R.drawable.paper;
case "Scissors": return R.drawable.scizor;
default: return R.drawable.rock;
}
}
}

Sharad Institute of Technology Polytechnic, Yadrav. Page 11


Rock Paper Scissors Game
EMI CalculatorEMI Calculator EMI
2024-25

Ca

Output:

Sharad Institute of Technology Polytechnic, Yadrav. Page 12


Rock Paper Scissors Game
EMI CalculatorEMI Calculator EMI
2024-25

Ca

9. Application of this Micro - project: -

 Game Development: Serves as a foundation for building more complex Android games.
 AI and Probability Learning: Helps in understanding randomness and decision-making.
 Android Development Practice: Enhances coding skills for mobile applications.
 Entertainment and Learning: Provides a fun way to learn programming concepts.

10. Conclusion

The Rock Paper Scissors game demonstrates fundamental programming concepts such as conditional
statements, randomness, and UI interaction. This project is an excellent way for beginners to strengthen
their coding skills while creating an enjoyable and interactive mobile game.

11. References:-

 Android Developer Documentation: https://developer.android.com/


 Java Documentation: https://docs.oracle.com/javase/8/docs/
 Random Library in Java: https://docs.oracle.com/javase/8/docs/api/java/util/Random.html

Sharad Institute of Technology Polytechnic, Yadrav. Page 13

You might also like