{"id":26657766,"url":"https://github.com/nuraj250/tictacflask","last_synced_at":"2026-05-04T03:36:23.420Z","repository":{"id":279659563,"uuid":"933315131","full_name":"Nuraj250/TicTacFlask","owner":"Nuraj250","description":"A web-powered Tic-Tac-Toe game built with Python, Pygame, and Flask. This project integrates a classic game with a backend for tracking scores, multiplayer functionality, and enhanced game logic. Learn about event handling, animations, and real-time interactions while building this fun and interactive game.","archived":false,"fork":false,"pushed_at":"2025-02-28T15:33:29.000Z","size":67,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T09:16:29.999Z","etag":null,"topics":["animations","eventhandling","flask","gamedevelopment","multiplayer","pygame","python","tic-tac-toe","webintegration"],"latest_commit_sha":null,"homepage":"","language":"Python","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/Nuraj250.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}},"created_at":"2025-02-15T17:01:55.000Z","updated_at":"2025-02-28T15:33:32.000Z","dependencies_parsed_at":"2025-02-26T18:49:10.771Z","dependency_job_id":null,"html_url":"https://github.com/Nuraj250/TicTacFlask","commit_stats":null,"previous_names":["nuraj250/tictacflask"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Nuraj250/TicTacFlask","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nuraj250%2FTicTacFlask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nuraj250%2FTicTacFlask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nuraj250%2FTicTacFlask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nuraj250%2FTicTacFlask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nuraj250","download_url":"https://codeload.github.com/Nuraj250/TicTacFlask/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nuraj250%2FTicTacFlask/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32593945,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T22:12:39.696Z","status":"online","status_checked_at":"2026-05-04T02:00:06.625Z","response_time":58,"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":["animations","eventhandling","flask","gamedevelopment","multiplayer","pygame","python","tic-tac-toe","webintegration"],"created_at":"2025-03-25T09:16:33.206Z","updated_at":"2026-05-04T03:36:23.391Z","avatar_url":"https://github.com/Nuraj250.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🎮 Web-Powered Tic-Tac-Toe Game\n\nThis is a **fully-featured Tic-Tac-Toe game** built with **Flask, Pygame, PostgreSQL/Firebase, and WebSockets**.  \nIt supports **multiplayer matchmaking, AI opponents, chat system, leaderboards, animations, and sound effects**.\n\n---\n\n## **🚀 Features**\n✅ **Classic Tic-Tac-Toe Gameplay** (Pygame-based UI)  \n✅ **Multiplayer Mode** (Real-time matchmaking via Flask-SocketIO)  \n✅ **Single-Player Mode (AI Opponent)** (Minimax Algorithm)  \n✅ **ELO-Based Ranking System**  \n✅ **In-Game Chat System**  \n✅ **Flashing Win Animation \u0026 Sound Effects**  \n✅ **Match History \u0026 Leaderboard**  \n\n---\n\n## **📚 Project Structure**\n```\ntic-tac-toe-web/\n├── backend/                     # Flask Backend\n│   ├── models/                   # Database Models\n│   ├── routes/                   # API Endpoints\n│   ├── services/                 # Business Logic\n│   ├── utils/                    # Utilities\n│   ├── database/                 # Database Setup\n│   ├── scripts/                  # Deployment \u0026 Server Management\n│   ├── tests/                    # Unit \u0026 Integration Tests\n│   ├── config.py                 # Configuration\n│   ├── app.py                    # Main Flask Application\n│   ├── requirements.txt          # Dependencies\n│   ├── .env                      # Environment Variables\n│   ├── README.md                 # Backend Documentation\n├── frontend/                     # Pygame Frontend\n│   ├── assets/                    # Game Assets (Images, Sounds)\n│   ├── components/                # UI Components\n│   ├── services/                  # API \u0026 WebSocket Services\n│   ├── main.py                    # Main Pygame Application\n│   ├── settings.py                # Game Configuration\n│   ├── README.md                  # Frontend Documentation\n├── README.md                      # Full Project Documentation\n```\n\n---\n\n## **📦 Installation \u0026 Setup**\n### **1️⃣ Clone the Repository**\n```bash\ngit clone https://github.com/Nuraj250/tic-tac-toe-web.git\ncd tic-tac-toe-web\n```\n\n### **2️⃣ Backend Setup**\n#### **Create Virtual Environment \u0026 Install Dependencies**\n```bash\ncd backend\npython -m venv venv\nsource venv/bin/activate  # Windows: venv\\Scripts\\activate\npip install -r requirements.txt\n```\n\n#### **Configure Environment Variables**\nCreate a `.env` file in `backend/`:\n```env\nSECRET_KEY=your_secret_key\nJWT_SECRET_KEY=your_jwt_secret\nDATABASE_URL=postgresql://user:password@localhost/tic_tac_toe\nSOCKETIO_MESSAGE_QUEUE=redis://\n```\n\n#### **Initialize Database**\n```bash\npython database/init_db.py\n```\n\n#### **Start the Flask API**\n```bash\nbash scripts/start_server.sh\n```\nor manually:\n```bash\npython app.py\n```\n\n---\n\n### **3️⃣ Frontend Setup**\n#### **Install Dependencies**\n```bash\ncd frontend\npip install pygame requests socketio-client\n```\n\n#### **Run the Pygame Frontend**\n```bash\nbash ../backend/scripts/start_game.sh\n```\nor manually:\n```bash\npython main.py\n```\n\n---\n\n## **🎮 Gameplay Instructions**\n### **Game Controls**\n- **Click on a cell** to place your move.\n- **Wait for your turn** (if multiplayer).\n- **Press \"H\"** to view match history.\n- **Click \"Restart\"** after a win to start a new game.\n\n### **Multiplayer Mode**\n1. The game **automatically pairs** two players.\n2. **Wait in the lobby** until an opponent joins.\n3. Moves are **synced in real-time** via WebSockets.\n\n### **Single-Player Mode (vs AI)**\n1. Click on a cell to place **\"X\"**.\n2. AI will **automatically respond** as \"O\".\n3. Try to **win against the AI!**\n\n---\n\n## **📡 API Endpoints**\n### **🔐 Authentication**\n| Method | Endpoint             | Description              |\n|--------|----------------------|--------------------------|\n| `POST` | `/api/auth/register` | Register a new user      |\n| `POST` | `/api/auth/login`    | Login \u0026 get JWT token    |\n\n### **🎮 Game Logic**\n| Method | Endpoint             | Description              |\n|--------|----------------------|--------------------------|\n| `POST` | `/api/game/play_move` | Submit a move            |\n| `GET`  | `/api/match/{id}`    | Get match history        |\n\n### **🤖 AI Opponent**\n| Method | Endpoint             | Description              |\n|--------|----------------------|--------------------------|\n| `POST` | `/api/ai-move`       | Get AI move suggestion   |\n\n### **🏆 Leaderboard**\n| Method | Endpoint              | Description              |\n|--------|----------------------|--------------------------|\n| `GET`  | `/api/leaderboard`    | Get top players         |\n\n### **💬 Chat System**\n| Method | Endpoint              | Description              |\n|--------|----------------------|--------------------------|\n| `POST` | `/api/chat/send-message` | Send chat message     |\n\n---\n\n## **🔊 Sound \u0026 Animations**\n### **Animations**\n- Moves are **animated with a fade effect**.\n- Winning row **flashes yellow** before showing the restart button.\n\n### **Sound Effects**\n| Action | Sound File | Description |\n|--------|-----------|-------------|\n| **Move Placement** | `move_sound.wav` | Plays when a move is made |\n| **Click Sound** | `click_sound.wav` | Plays when clicking UI elements |\n| **Win Sound** | `win_sound.wav` | Plays when a player wins |\n\n---\n\n## **📜 Deployment**\n### **1️⃣ Deploy on Heroku**\n```bash\nheroku login\nheroku create tic-tac-toe-web\ngit push heroku main\n```\n\n### **2️⃣ Deploy on AWS (EC2)**\n```bash\nscp -i your-key.pem backend/* ec2-user@your-instance:/home/ec2-user/\nssh -i your-key.pem ec2-user@your-instance\n```\n\n### **3️⃣ Deploy on DigitalOcean**\nUse **Docker**:\n```bash\ndocker build -t tic-tac-toe-backend .\ndocker run -p 5000:5000 tic-tac-toe-backend\n```\n\n---\n\n## **💡 Troubleshooting**\n### **Game Won't Start?**\n- Ensure **Flask backend is running**:\n```bash\nbash backend/scripts/start_server.sh\n```\n- Check `API_BASE_URL` in `frontend/settings.py`.\n\n### **Database Connection Issues**\n- Ensure PostgreSQL is running:\n```bash\nsudo service postgresql start\n```\n- Verify database URL in `.env`.\n\n### **Flask-SocketIO Not Working?**\n- Install Redis:\n```bash\nsudo apt install redis-server\n```\n- Start Redis:\n```bash\nredis-server\n```\n\n---\n\n## **🐝 License**\nThis project is licensed under the **MIT License**.\n\n---\n\n## **💍 Connect**\n💻 [Nuraj](https://github.com/Nuraj250)  \n🚀 Happy Coding! 🎮🔥\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnuraj250%2Ftictacflask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnuraj250%2Ftictacflask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnuraj250%2Ftictacflask/lists"}