0% found this document useful (0 votes)
2 views17 pages

Cs Project

The document is a project report on the game Rock Paper Scissors, created by student Neev Chaprana for the Computer Science subject in Class XII at Eicher School. It outlines the project's objectives, including the development of a human vs. computer simulation, exploration of probability and game theory, and the creation of an engaging user interface. The report also includes acknowledgments, hardware and software requirements, source code, and testing procedures.

Uploaded by

neevchaprana
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)
2 views17 pages

Cs Project

The document is a project report on the game Rock Paper Scissors, created by student Neev Chaprana for the Computer Science subject in Class XII at Eicher School. It outlines the project's objectives, including the development of a human vs. computer simulation, exploration of probability and game theory, and the creation of an engaging user interface. The report also includes acknowledgments, hardware and software requirements, source code, and testing procedures.

Uploaded by

neevchaprana
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/ 17

EICHER SCHOOL

Project Report on
ROCK PAPER SCISSORS
for
Computer Science
Session:2024-25
NAME: Neev Chaprana
ROLL NUMBER:
CLASS: XII-A
SUB. CODE: 083
CERTIFICATE
This is to certify that cadet Neev
Chaprana Roll no: ………………………
has successfully completed the
project work entitled ROCK PAPER
SCISSORS in the subject Computer
science (083) laid down in the
regulations of CBSE for the purposes
of Practical examination in Class XII to
be held in Eicher School, Faridabad,
Haryana

Mrs. Lalita
PGT Computer Science

Examiner
Name:
Signature:

TABLE OF CONTENT
S.no Description
1 ACKNOWLEDGEMENT
2 INTRODUCTION
3 OBJECTIVES OF THE
PROJECT
4 SYSTEM DEVELOPMENT
LIFE CYCLE(SDLO)
5 MODULES USED AND
THEIR PURPOSE
6 FLOW CHART
7 SOURCE CODE
8 OUTPUT
9 TESTING
10 HARDWARE AND
SOFTWARE
REQUIREMENT
11 INSTALLATION
PROCEDURE
12 BIBLIOGRAPHY

ACKNOWLEDGEMENT
Apart from my efforts, the success of any
project depends largely on the
encouragement and guidelines of many
others. I take this opportunity to express my
gratitude to the people who have been
instrumental in the successful completion of
this project.
I express my deep sense of gratitude to the
luminary The Principal who has been
continuously motivating and extending their
helping hand to us.
I express my sincere thanks to the
academician, the Vice Principal, for constant
encouragement and the guidance provided
during this project.
My sincere thanks to Mrs. Lalita,The guidance
and support received from all the members
who contributed and who are contributing to
this project, was vital for the success of the
project. I am grateful for their constant
support and help.

PROJECT ON
ROCK PAPER SCISSORS
INTRODUCTION
Rock, Paper, Scissors is a simple hand game
played between two participants, where rock
crushes scissors, scissors cuts paper, and
paper covers rock. Despite its simplicity, the
game offers insights into strategy, chance,
and decision-making. This project explores
the game’s dynamics, focusing on both
human vs. human and human vs. computer
interactions. We’ll examine how algorithms
can predict or improve decisions and discuss
how the game connects to concepts in
probability, game theory, and artificial
intelligence. Ultimately, this project highlights
Rock, Paper, Scissors as both entertaining and
educational tools.

Objectives of the Project


 Human vs. Computer Simulation:
Develop an algorithm to simulate a
computer opponent that can make
decisions based on randomness or
strategy.
 Explore Probability and Game Theory:
Investigate how probability theory applies
to Rock, Paper, Scissors and explore
strategies like the Nash Equilibrium.
 Algorithmic Decision Making: Design
and implement algorithms that enhance
decision-making in the game, potentially
using machine learning techniques.
 User Interface Development: Create an
engaging and user-friendly interface for
players to interact with the game, both for
human vs. human and human vs.
computer modes.
 Educational Insight: Demonstrate how
Rock, Paper, Scissors can be used as a
learning tool for introducing concepts in
computer science, probability, and AI.

HARDWARE AND
SOFTWARE
REQUIREMENTS
1. OPERATING SYSTEM: Windows 7 or Above
Mac OS X 10.11 or higher, 64-bit
Linux: RHEL 6/7, 64-bit
II. PROCESSOR: Intel(R) Core (TMi5-10400F
CPU @2.90GHz 2.90 GHz)
III. MOTHERBOARD: GIGABYTE B760M DS3H
AX DDR4 IV. RAM :8 GB+
V. HARD DISK: SATA 40 GB OR ABOVE
VI. CD/DVD r/w multi drive combo: (If back up
required)
VII. FLOPPY DRIVE: 1.44 MB (If Backup
required)
VIII. MONITOR :15-17 inch

PROJECT CODE
import random
import mysql.connector
from mysql.connector import Error

def connect_to_database():
try:
connection = mysql.connector.connect(
host="localhost",
user="root",
password="password",
database="rps_game" )
if connection.is_connected():
print("Connected to MySQL
database.")
return connection
except Error as e:
print(f"Error connecting to database:
{e}")
return None

def
insert_session_highest_winstreak(connection,
highest_winstreak):
try:
cursor = connection.cursor()
query = "INSERT INTO session_stats
(highest_winstreak) VALUES (%s)"
cursor.execute(query,
(highest_winstreak,))
connection.commit()
print(f"Session saved with highest win
streak: {highest_winstreak}")
except Error as e:
print(f"Error inserting data: {e}")

def get_user_choice():
print("Enter your choice: rock, paper, or
scissors")
while True:
choice = input("Your choice: ").lower()
if choice in ["rock", "paper", "scissors"]:
return choice
else:
print("Invalid choice. Please enter
rock, paper, or scissors.")
def get_computer_choice():
return random.choice(["rock", "paper",
"scissors"])

def determine_winner(user_choice,
computer_choice):
if user_choice == computer_choice:
return "tie"
elif (user_choice == "rock" and
computer_choice == "scissors") or \
(user_choice == "paper" and
computer_choice == "rock") or \
(user_choice == "scissors" and
computer_choice == "paper"):
return "user"
else:
return "computer"
def main():
connection = connect_to_database()
if not connection:
print("Unable to connect to the
database. Exiting game.")
return

print("Welcome to Rock-Paper-Scissors with


Database-Tracked Win Streaks!")
win_streak = 0
highest_winstreak = 0

while True:
user_choice = get_user_choice()
computer_choice =
get_computer_choice()
print(f"\nYou chose: {user_choice}")
print(f"Computer chose:
{computer_choice}")

result = determine_winner(user_choice,
computer_choice)

if result == "user":
win_streak += 1
highest_winstreak =
max(highest_winstreak, win_streak)
print(f"\nYou win! Current win streak:
{win_streak}")
elif result == "computer":
print("\nComputer wins! Your win
streak has ended.")
win_streak = 0
else:
print("\nIt's a tie! Your win streak
continues.")
play_again = input("Do you want to play
again? (yes/no): ").lower()
if play_again != "yes":
print(f"\nYour highest win streak this
session: {highest_winstreak}")

insert_session_highest_winstreak(connection,
highest_winstreak)
print("Thanks for playing! Goodbye!")
break

if connection.is_connected():
connection.close()
print("Database connection closed.")

if __name__ == "__main__":
main()
Screenshot of the game
Photo of MYSQL

You might also like