{"id":30905275,"url":"https://github.com/depapp/rock-paper-scissors","last_synced_at":"2026-07-03T14:05:11.378Z","repository":{"id":311084146,"uuid":"1032352585","full_name":"depapp/rock-paper-scissors","owner":"depapp","description":"an AI Prediction Game","archived":false,"fork":false,"pushed_at":"2025-08-22T01:31:53.000Z","size":100,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-09T10:59:50.528Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://rock-paper-scissors-web-ebon.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/depapp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-05T07:23:36.000Z","updated_at":"2025-08-22T01:35:39.000Z","dependencies_parsed_at":"2025-08-22T03:40:33.728Z","dependency_job_id":"9759a36a-0be2-42d3-8f7b-e01af44efaac","html_url":"https://github.com/depapp/rock-paper-scissors","commit_stats":null,"previous_names":["depapp/rock-paper-scissors"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/depapp/rock-paper-scissors","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/depapp%2Frock-paper-scissors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/depapp%2Frock-paper-scissors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/depapp%2Frock-paper-scissors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/depapp%2Frock-paper-scissors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/depapp","download_url":"https://codeload.github.com/depapp/rock-paper-scissors/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/depapp%2Frock-paper-scissors/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35088509,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-03T02:00:05.635Z","response_time":110,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-09-09T10:08:23.501Z","updated_at":"2026-07-03T14:05:11.354Z","avatar_url":"https://github.com/depapp.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🧠 Rock Paper Scissors Mind Reader - AI Prediction Game\n\nAn innovative real-time AI-powered prediction game where players battle against an AI that learns their patterns and tries to predict their next move in Rock Paper Scissors. Built for the Redis \"Real-Time AI Innovators\" challenge.\n\n## Full Explanation on DEV.to Article\n- https://dev.to/depapp/building-a-mind-reading-ai-rock-paper-scissors-with-redis-8s-real-time-magic-3d7h\n\n## 🎮 Game Concept\n\nPlayers choose between Rock ✊, Paper 📄, or Scissors ✂️ while an AI analyzes their patterns in real-time and predicts their next choice. The AI's prediction is hidden until after the player makes their choice, creating true suspense. The AI gets smarter with each move, learning from:\n- Frequency patterns\n- Sequential patterns\n- Complex multi-step patterns\n- Meta-patterns (trying to be unpredictable)\n- Psychological patterns (panic choices, pressure responses)\n\n## 🚀 Key Features\n\n### Real-Time AI Learning\n- **Pattern Recognition**: AI analyzes player behavior in real-time\n- **Adaptive Difficulty**: AI confidence grows as it learns your patterns\n- **Explainable AI**: AI explains its reasoning for each prediction\n- **Multiple Pattern Types**: From simple frequency to complex psychological patterns\n\n### Redis-Powered Performance\n- **Vector Search**: Semantic pattern matching for similar player behaviors\n- **Semantic Caching**: Caches AI predictions for similar patterns\n- **Real-time Streams**: Records every move for pattern analysis\n- **Time-Series Data**: Tracks accuracy and performance metrics\n- **Pub/Sub**: Real-time multiplayer updates and global statistics\n- **Leaderboards**: Global rankings using Redis sorted sets\n\n### Engaging Gameplay\n- **Visual Feedback**: Real-time pattern visualization\n- **Randomness Score**: Shows how unpredictable you are\n- **Live Statistics**: See your patterns as the AI sees them\n- **Achievement System**: Unlock achievements for various play styles\n\n### Security \u0026 Privacy\n- **Client-Side API Keys**: Each player uses their own Gemini API key\n- **Local Storage Only**: API keys are stored in browser localStorage, never sent to servers\n- **Per-Player AI**: Each player gets personalized AI predictions using their own API quota\n- **No Server Storage**: The server never sees or stores any API keys\n\n## 🛠️ Tech Stack\n\n### Backend\n- **Node.js + TypeScript**: Fast, type-safe server\n- **Express + Socket.io**: Real-time bidirectional communication\n- **Redis Cloud**: All data operations and caching\n- **Google Gemini AI**: Advanced pattern analysis and explanations\n\n### Frontend\n- **Next.js 14**: React framework with App Router\n- **Tailwind CSS**: Responsive, beautiful UI\n- **Framer Motion**: Smooth animations\n- **Zustand**: Lightweight state management\n\n### Infrastructure\n- **Monorepo**: Organized with workspaces\n- **Shared Types**: Type safety across frontend/backend\n- **Docker Ready**: Easy deployment\n\n## 📦 Installation\n\n1. Clone the repository:\n```bash\ngit clone \u003crepository-url\u003e\ncd mind-reader-battle\n```\n\n2. Install dependencies:\n```bash\nnpm install\n```\n\n3. Set up environment variables:\n\nCreate `.env.local` in `apps/server/`:\n```env\n# Redis Configuration\nREDIS_USERNAME=your_redis_username\nREDIS_PASSWORD=your_redis_password\nREDIS_HOST=your_redis_host\nREDIS_PORT=your_redis_port\n\n# Server Configuration\nPORT=3001\nNODE_ENV=development\n```\n\n**Note**: The Gemini API key is now provided by each player individually through the game interface, not through server environment variables.\n\n4. Run the development servers:\n```bash\nnpm run dev\n```\n\nThis starts both the backend (port 3001) and frontend (port 3000).\n\n## 🎯 How to Play\n\n1. **Get Your Gemini API Key**:\n   - Visit [Google AI Studio](https://aistudio.google.com)\n   - Sign in with your Google account\n   - Click \"Create API Key\"\n   - Copy the API key\n\n2. **Enter the Game**:\n   - Choose a username\n   - Paste your Gemini API key (stored locally, never sent to servers)\n   - Click \"Start Playing\"\n\n3. **Play the Game**:\n   - **Choose**: Select Rock, Paper, or Scissors\n   - **Wait**: AI secretly predicts your move\n   - **Reveal**: See if the AI guessed correctly\n   - **Learn**: Watch your patterns emerge in real-time\n   - **Adapt**: Try to be unpredictable to beat the AI\n\n### Game Rules\n- ✊ Rock beats ✂️ Scissors\n- 📄 Paper beats ✊ Rock  \n- ✂️ Scissors beats 📄 Paper\n\n## 🏆 Scoring System\n\n- **Player scores** when AI predicts incorrectly\n- **AI scores** when it predicts correctly\n- **AI uses multiple strategies** to predict your next move\n- **Randomness score** shows how unpredictable you are\n- **Pattern detection** includes frequency, sequential, and psychological analysis\n\n## 📊 Redis Feature Showcase\n\n### 1. Vector Search (Pattern Matching)\n```javascript\n// Find players with similar patterns\nconst similar = await redis.ft.search('idx:profiles', \n  `*=\u003e[KNN 10 @embedding $vec]`\n)\n```\n\n### 2. Semantic Caching\n```javascript\n// Cache AI predictions for similar patterns\nawait redis.setex(`analysis:${patternHash}`, 300, prediction)\n```\n\n### 3. Real-time Streams\n```javascript\n// Record every move for analysis\nawait redis.xadd('moves:gameId', '*', moveData)\n```\n\n### 4. Time-Series Metrics\n```javascript\n// Track AI accuracy over time\nawait redis.ts.add('ai:accuracy', '*', accuracyScore)\n```\n\n### 5. Pub/Sub Communication\n```javascript\n// Broadcast game updates\nredis.publish('game:updates', gameState)\n```\n\n## 🚀 Deployment\n\n### Frontend (Vercel)\n```bash\ncd apps/web\nvercel\n```\n\n### Backend (Railway/Render)\n1. Deploy the server app\n2. Set environment variables\n3. Ensure WebSocket support is enabled\n\n## 🎮 Demo Scenarios\n\n1. **Pattern Evolution**: Show how AI learns from sequential patterns\n2. **Randomness Challenge**: Demonstrate high randomness gameplay\n3. **Multiplayer Stats**: Show global statistics updating in real-time\n4. **Cache Performance**: Demonstrate instant predictions from cache\n\n## 🏅 Why This Wins\n\n1. **Innovative AI Use**: Real-time learning with explainable AI\n2. **Redis Showcase**: Uses 6+ Redis features naturally\n3. **Engaging Gameplay**: Addictive \"just one more round\" experience\n4. **Technical Excellence**: Clean architecture, type-safe, performant\n5. **Accessibility**: Clear UI, helpful explanations, works for all skill levels\n\n## 📝 License\n\nMIT License - feel free to use this project as inspiration!\n\n## 🙏 Acknowledgments\n\nBuilt for the Redis \"Real-Time AI Innovators\" challenge. Special thanks to Redis for providing an amazing real-time data platform that makes this kind of innovative AI application possible.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdepapp%2Frock-paper-scissors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdepapp%2Frock-paper-scissors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdepapp%2Frock-paper-scissors/lists"}