0% found this document useful (0 votes)
27 views16 pages

Priyanka Ai

Uploaded by

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

Priyanka Ai

Uploaded by

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

Visvesvaraya Technological University

“Jnana Sangama”, Belgaum-590 018


***********************************************************

Vth Semester
Computer science and Engineering

ASSESSMENT REPORT
“ARTIFICIAL INTELLIGENCE”
(BCS515B)

Name

USN

Section

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING


KALPATARU INSTITUTE OF TECHNOLOGY
TIPTUR-572 202

Assessment Marks (15) Staff Signature


ACKNOWLEDGEMENT
I feel myself honored and privileged to place my warm salutation to our college
KALPATARU INSTITUTE OF TECHNOLOGY and DEPARTMENT OF COMPUTER
SCIENCE which gave me the opportunity to have expertise in Engineering and
profound technical knowledge.

I would like to convey thanks to my Project Guide DR SANJAY KUMAR N V for


his regular guidance and constant encouragement and I am extremely grateful to him
for his valuable suggestions and unflinching cooperation throughout project work.

With profound gratitude, I express my heartiest thanks to DR MAITHRI C,


HEAD OF DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING for
encouraging me in every aspect of my project.

With Regards and Gratitude

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.

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEEINRG 1


ROCK PAPER SCISSORS

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

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 2


ROCK PAPER SCISSORS

CHAPTER 3
DESIGN

1. Start the Game:


Display a welcome message and instructions for the user (how to play and exit).

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!".

7. Play Again or Exit:


Ask the user if they want to play another round.
If the user types exit, thank them for playing and end the game.

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEEINRG 3


ROCK PAPER SCISSORS

CHAPTER 4
IMPLEMENTATION

The Rock, Paper, Scissors program is implemented in Python by first displaying a


welcome message and instructions for the user. The user is then prompted to input
one of three choices: rock, paper, or scissors. If the user types an invalid input,
such as something other than these three choices or exit, the program will ask for
a valid input again. Once the user makes a valid choice, the program generates a
random choice for the computer using Python’s random.choice() function. The
program then compares the user's input with the computer's input to determine the
winner, based on the rules of the game: rock beats scissors, scissors beats paper,
and paper beats rock. If both choices are the same, the result is a tie. After
displaying the result, the program asks the user whether they want to play another
round or exit. If the user chooses to exit, the program thanks them for playing and
ends. This loop continues until the user decides to quit, providing a simple and
engaging gameplay experience.

DEPARTMENT OF COMPUTER SCEINCE AND ENGINEERING 4


ROCK PAPER SCISSORS

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")

choices = ["rock", "paper", "scissors"]

while True:
# Get player's choice
player_choice = input("Your choice: ").lower()
if player_choice == "quit":
print("Thanks for playing! Goodbye.")
break

if player_choice not in choices:


print("Invalid choice. Please try again!")
continue

# Get computer's choice


computer_choice = random.choice(choices)
print(f"Computer chose: {computer_choice}")

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 5


ROCK PAPER SCISSORS

IMPLEMENTATION:

# Determine the winner

if player_choice == computer_choice:
print("It's a tie!")

choices = ["rock", "paper", "scissors"]

elif (player_choice == "rock" and computer_choice == "scissors") or \


(player_choice == "scissors" and computer_choice == "paper") or \
(player_choice == "paper" and computer_choice == "rock"):
print("You win!")

else:
print("You lose!")

print() # Blank line for better readability

# Run the game


rock_paper_scissors()

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 6


ROCK PAPER SCISSORS
CHAPTER 5
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 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.

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 7


ROCK PAPER SCISSORS

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:

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.

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 8


ROCK PAPER SCISSORS

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.

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 9


ROCK PAPER SCISSORS

CHAPTER 7
OUTPUT

Welcome to Rock, Paper, Scissors!


Type 'rock', 'paper', or 'scissors' to play.
Type 'quit' to exit the game.

Your choice: rock


Computer chose: scissors
You win!

Your choice: paper


Computer chose: paper
It's a tie!

Your choice: scissors


Computer chose: paper
You win!

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 10


ROCK PAPER SCISSORS

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.

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 11


ROCK PAPER SCISSORS

CHAPTER 9
BIBLIOGRAPHY

Text books referred:


Learning Python – Mark Lutz

Websites referred:

https://www.wikipedia.org/

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 12

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy