Project Report
Project Report
A PROJECT REPORT
Submitted by
BONAFIDE CERTIFICATE
SIGNATURE SIGNATURE
BONAFIDE CERTIFICATE
SIGNATURE SIGNATURE
BONAFIDE CERTIFICATE
SIGNATURE SIGNATURE
BONAFIDE CERTIFICATE
SIGNATURE SIGNATURE
1 Project Overview 7
2 7
Objectives
3 7-8
Technical Details
4 Code 9-10
5 11
Example Usage
6 11
Conclusions and Future Improvements
7 References 12
Project Report: Rock, Paper, Scissors
Game
### Project Overview
The Rock, Paper, Scissors game is a classic hand game that is played between two people.
Each player simultaneously forms one of three shapes with their hand. The possible shapes
are rock, paper, and scissors. The game is a simple example of a decision-making process
based on predefined rules.
### Objectives
Programming Language
Python: The game is implemented using Python 3. The simplicity of the language and its
readability make it ideal for this task.
Key Components
1. get_computer_choice()
- Purpose: To randomly select one of the three choices (rock, paper, or scissors) for the
computer.
- Implementation: Utilizes the `random.choice()` method from Python's `random` module
to make a random selection from a list of choices.
2. get_user_choice()
- Purpose: To capture and validate the user's input.
- Implementation: Prompts the user to enter their choice, ensures it is one of the valid
options (rock, paper, or scissors), and keeps asking until a valid choice is provided.
3. determine_winner(user_choice, computer_choice)
- Purpose: To determine the winner of the game based on the choices made by the user
and the computer.
- Implementation: Compares the user's choice and the computer's choice using conditional
statements to determine the result (win, lose, or tie).
4. play_game()
- Purpose: To manage the game flow.
- Implementation: Calls other functions to get the user and computer choices, displays the
choices, determines the result, and prints the outcome.
Code Execution
- get_computer_choice(): Selects a random choice for the computer.
- get_user_choice(): Ensures that the user's input is valid.
- determine_winner(user_choice, computer_choice): Evaluates the result of the game based
on the rules of Rock, Paper, Scissors.
- play_game(): Orchestrates the game, handles user interaction, and displays the results.
### Code
import random
def get_user_choice():
return choice
def get_computer_choice():
return random.choice(choices)
if user_choice == computer_choice:
user_choice = get_user_choice()
computer_choice = get_computer_choice()
print(result)
if __name__ == "__main__":
play_game()
### Example Usage
When the game is executed, it prompts the user to enter their choice. After the user inputs
their choice, the computer's choice is randomly generated. The results of the game (win,
lose, or tie) are then displayed based on the rules.
Sample Output
### Conclusion
The Rock, Paper, Scissors game successfully demonstrates basic programming concepts such
as user input handling, random number generation, and conditional logic. The project
showcases how to create an interactive console-based game using Python, making it a
valuable exercise for beginners to understand fundamental programming techniques.
- GUI Implementation: Develop a graphical user interface for a more interactive experience.
- Enhanced Validation: Improve input validation to handle edge cases or unexpected inputs
more gracefully.
### References