Priyanka Ai
Priyanka Ai
Vth Semester
Computer science and Engineering
ASSESSMENT REPORT
“ARTIFICIAL INTELLIGENCE”
(BCS515B)
Name
USN
Section
PRIYANKA HU
DECLARATION
I hereby declare that the Project entitled “ROCK PAPER SCISSORS”
submitted to KALPATARU INSTITUTE OF TECHNOLOGY, affiliated to
Visvesvaraya Technological University for the award of the Degree of the
Bachelor of Engineering in Computer Science Engineering is a result of
original work done by me.
PRIYANKA HU 1KI22CS087
ROCK PAPER SCISSORS
CHAPTER 1
ABSTRACT
This Python program implements a simple text-based Rock, Paper, Scissors game where a user
competes against the computer. The game continues in a loop until the user decides to exit. The
user is prompted to input one of three choices: "rock," "paper," or "scissors," and the computer
randomly selects one of these options. The program then compares the user's and the computer's
choices to determine the winner based on the game's traditional rules. The result of each round is
displayed, and the game continues until the user chooses to exit.
The game allows the user to input one of three choices: "rock," "paper," or "scissors."
The computer randomly selects one of the three choices.
The program compares the choices and determines the winner.
The game runs in a loop, allowing the user to play multiple rounds.
The game terminates when the user types 'exit.'
Invalid inputs are handled by prompting the user to enter a valid option.
CHAPTER 2
REQUIREMENTS
System requirements:
Hardware Requirements:
Processor: A basic processor (e.g., Intel Core i3 or
equivalent) is sufficient, as this program is lightweight and
does not require intensive computational resources.
Memory (RAM): At least 1 GB of RAM should be enough for
running this simple Python program.
Storage: Minimal storage is required, as the program is small
in size (usually a few KBs).
Software Requirements:
Operating System: The program can run on any modern
operating system, including:
Windows (Windows 7, 8, 10, 11)
macOS (macOS 10.12 or higher)
Linux (any distribution with Python installed)
Python: Python 3.x (preferred version 3.6 or higher) must be
installed on the system. You can download Python from the
official website here
CHAPTER 3
DESIGN
2. User Input:
Prompt the user to enter one of three choices: rock, paper, or scissors.
Optionally, the user can type exit to quit the game.
3. Input Validation:
Check if the user's input is valid (one of the three choices or exit).
If invalid, prompt the user to enter a valid option.
4. Computer's Choice:
Randomly select one of the three choices (rock, paper, or scissors) for the computer
.
5. Determine the Winner:
Compare the user's choice with the computer's choice based on the game rules:
1. Rock beats Scissors
2. Scissors beats Paper
3. Paper beats Rock
4. If both choices are the same, it's a tie.
6. Display Results:
Show the user the result: "You win!", "You lose!", or "It's a tie!".
CHAPTER 4
IMPLEMENTATION
IMPLEMENTATION:
import random
def rock_paper_scissors():
print("Welcome to Rock, Paper, Scissors!")
print("Type 'rock', 'paper', or 'scissors' to play.")
print("Type 'quit' to exit the game.\n")
while True:
# Get player's choice
player_choice = input("Your choice: ").lower()
if player_choice == "quit":
print("Thanks for playing! Goodbye.")
break
IMPLEMENTATION:
if player_choice == computer_choice:
print("It's a tie!")
else:
print("You lose!")
The testing of the Rock, Paper, Scissors program involves checking if the game handles
various user inputs, generates a random computer choice, and correctly determines the
winner based on the established rules. During testing, the program should provide
accurate results for valid inputs (rock, paper, or scissors) and properly handle invalid
inputs by prompting the user again. It should also correctly terminate when the user
types exit. The test cases ensure that the game logic works, including handling ties,
wins, and losses.
Test Case 1:
Input:
User : rock Computer
scissors (random)
Expected Output:
"You win!"
Testing Conclusion:
The program successfully handles different game scenarios, correctly determining
the winner based on user and computer choices. It also manages invalid inputs by
prompting the user to re-enter a valid option, and it properly exits when requested.
TESTING :
The testing of the Rock, Paper, Scissors program involves checking if the game
handles various user inputs, generates a random computer choice, and correctly
determines the winner based on the established rules. During testing, the program
should provide accurate results for valid inputs (rock, paper, or scissors) and
properly handle invalid inputs by prompting the user again. It should also correctly
terminate when the user types exit. The test cases ensure that the game logic
works, including handling ties, wins, and losses.
Test Case 2:
Input:
User: scissors
Computer: scissors (random)
Expected Output:
"It's a tie!"
Testing Conclusion:
CHAPTER 6
DEVELOPMENT AND MAINTENANCE
The development of the Rock, Paper, Scissors program involves writing the
core logic in Python, which includes functions for handling user input,
generating the computer's random choice, comparing the choices, and
determining the winner. The program is designed with simplicity, making it
easy to understand, extend, and maintain. During the maintenance phase,
regular updates might involve refining the input validation, improving the
user interface (e.g., adding a graphical interface), or introducing new
features like a score tracker or difficulty levels. Bug fixes and performance
enhancements are also part of maintenance, ensuring that the game
remains stable and enjoyable. Since the program is text-based, it is
lightweight and requires minimal resources, making it suitable for continued
support and scalability with additional features or improvements if needed.
CHAPTER 7
OUTPUT
CHAPTER 8
CONCLUSION
In conclusion, the Rock, Paper, Scissors program provides a simple and interactive way
to engage with users through basic game mechanics. It allows the user to play against
the computer, making a choice between rock, paper, or scissors, and determines the
winner based on the established game rules. The program handles input validation,
ensuring the user can only enter valid choices or exit the game. It also includes the
option to replay the game, enhancing user experience. Overall, this program
demonstrates the use of basic programming concepts such as user input, conditional
statements, randomization, and loops, while offering a fun and lightweight experience
that can be easily extended with additional features in the future.
CHAPTER 9
BIBLIOGRAPHY
Websites referred:
https://www.wikipedia.org/