An interactive web-based Rock Paper Scissors game that uses AI and hand gesture recognition to play against an intelligent AI opponent.
Demo | Blog |
---|---|
- Real-time hand gesture recognition using your webcam
- AI opponent that adapts to your playing patterns
- Visual feedback with confidence scoring
- Sleek, responsive UI with real-time scoring
- HTML5, CSS3, and JavaScript
- TensorFlow.js and MediaPipe Hands for hand gesture recognition
- Google Gemini API for intelligent AI opponent responses
- Canvas API for real-time drawing and visualization
- Google Gemini API key
-
Clone this repository:
git clone https://github.com/abhinavthedev/rock-paper-scissors.git cd rock-paper-scissors
-
Important: Add your Google Gemini API key
- Open
script.js
and at Line 30. - Replace it with your own API key:
const YOUR_API_KEY = 'YOUR_ACTUAL_API_KEY';
- Open
-
Serve the project using a local web server:
- copy the path of index.html in your web browser.
- Or use extensions like Live Server in VS Code
- Now, your application will be running on browser.
- Allow webcam access when prompted
- Click the "Start Game" button
- Follow the countdown (Rock, Paper, Scissors, Go!)
- Show your hand gesture to the webcam
- Hold your gesture steady until it's recognized (3 consecutive detections)
- See the AI's move and the round result
- Click "Play Again" to start a new round
rock-paper-scissors/
----- index.html - Main HTML structure
----- styles.css - CSS styling
----- script.js - Game logic and AI implementation
----- assets/ - Images and resources
- Webcam not working: Ensure you've granted camera permissions in your browser
- Hand detection issues: Make sure you have good lighting and your hand is clearly visible
- API errors: Verify your API key is correct and has the necessary permissions
- Performance issues: Try closing other applications or tabs that might be using your webcam
- Developed by Abhinav using Amazon Q Developer
- Hand gesture recognition powered by TensorFlow.js and MediaPipe
- AI opponent powered by Google Gemini API
This project is licensed under the MIT License - see the LICENSE file for details.