somya-27-04-03 commited on
Commit
f32fa0d
·
verified ·
1 Parent(s): bff82b2

Upload 3 files

Browse files
Files changed (2) hide show
  1. README.md +48 -14
  2. app.py +10 -2
README.md CHANGED
@@ -1,14 +1,48 @@
1
- ---
2
- title: Rock Paper Scissors Fullstack Game
3
- emoji: 🏆
4
- colorFrom: indigo
5
- colorTo: blue
6
- sdk: gradio
7
- sdk_version: 5.35.0
8
- app_file: app.py
9
- pinned: false
10
- license: mit
11
- short_description: A full stack game made with gradio and python.
12
- ---
13
-
14
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ✊✋✌️ Rock Paper Scissors Game
2
+
3
+ 🚀 Live Demo
4
+ 🔗 Play Now: https://huggingface.co/spaces/somya-27-04-03/Rock-paper-scissors-frontend
5
+
6
+ 🎮 Project Overview
7
+ This is a full-stack Rock Paper Scissors game with:
8
+
9
+ A lively frontend built using HTML, CSS, JavaScript
10
+ Backend logic and API built using Python Flask deployed on Render
11
+ Hosted frontend on Hugging Face Spaces
12
+
13
+ ⚙️ Features
14
+ 🎨 Attractive UI with blurred background images
15
+
16
+ 🖱️ Interactive buttons for each choice
17
+
18
+ 📊 Score tracking (player vs computer)
19
+
20
+ 🤖 Random computer choice generated on each play
21
+
22
+ 🔊 Sound effects for win, lose, and tie
23
+
24
+ 🌙 Theme toggle ready for future enhancements
25
+
26
+ 🔗 Backend API using Flask with deployed REST endpoint
27
+
28
+ 🛠️ Tech Stack
29
+ Frontend: HTML, CSS, JavaScript
30
+
31
+ Backend: Python Flask
32
+
33
+ Deployment: Render (backend), Hugging Face Spaces (frontend)
34
+
35
+ Version Control: Git & GitHub
36
+
37
+ 🤝 Contributing
38
+ Feel free to fork, raise issues, and submit pull requests to improve the UI, add multiplayer, or integrate advanced ML logic for dynamic gameplay.
39
+
40
+ 👤 Author
41
+ Somya Ranjan Mahapatra
42
+
43
+ GitHub
44
+
45
+ Hugging Face
46
+
47
+ ⭐ If you like this project, give it a star on GitHub to support my open-source work!
48
+
app.py CHANGED
@@ -5,6 +5,14 @@ import random
5
  player_score = 0
6
  computer_score = 0
7
 
 
 
 
 
 
 
 
 
8
  def play(user_choice):
9
  global player_score, computer_score
10
 
@@ -42,7 +50,7 @@ body {
42
  margin-top: 50px;
43
  }
44
  h1, h2, h3 {
45
- color: black; /* 🖤 heading color changed to black */
46
  text-align: center;
47
  }
48
  """) as demo:
@@ -53,4 +61,4 @@ h1, h2, h3 {
53
  play_button = gr.Button("Submit")
54
  output = gr.Textbox(label="output", lines=6)
55
  play_button.click(fn=play, inputs=user_choice, outputs=output)
56
- demo.launch()
 
5
  player_score = 0
6
  computer_score = 0
7
 
8
+ def reset_scores():
9
+ global player_score, computer_score
10
+ player_score = 0
11
+ computer_score = 0
12
+
13
+ # ✅ Reset scores when app starts
14
+ reset_scores()
15
+
16
  def play(user_choice):
17
  global player_score, computer_score
18
 
 
50
  margin-top: 50px;
51
  }
52
  h1, h2, h3 {
53
+ color: black;
54
  text-align: center;
55
  }
56
  """) as demo:
 
61
  play_button = gr.Button("Submit")
62
  output = gr.Textbox(label="output", lines=6)
63
  play_button.click(fn=play, inputs=user_choice, outputs=output)
64
+ demo.launch()