{"id":36964903,"url":"https://github.com/sepehrbayat/simple-chess-opensource","last_synced_at":"2026-01-13T19:48:26.432Z","repository":{"id":328648640,"uuid":"1116201916","full_name":"sepehrbayat/simple-chess-opensource","owner":"sepehrbayat","description":"A complete open-source chess game with AI opponent, move evaluation, and beautiful UI. Built with Python and Pygame.","archived":false,"fork":false,"pushed_at":"2025-12-14T14:10:04.000Z","size":54,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-16T21:04:51.153Z","etag":null,"topics":["ai","alpha-beta-pruning","artificial-intelligence","board-game","chess","chess-engine","educational","game-development","game-engine","minimax","open-source","pygame","pygame-tutorial","python","python-game"],"latest_commit_sha":null,"homepage":"https://linkedin.com/in/sepehrbayat","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sepehrbayat.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-14T12:05:29.000Z","updated_at":"2025-12-14T14:10:07.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/sepehrbayat/simple-chess-opensource","commit_stats":null,"previous_names":["sepehrbayat/simple-chess-opensource"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/sepehrbayat/simple-chess-opensource","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sepehrbayat%2Fsimple-chess-opensource","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sepehrbayat%2Fsimple-chess-opensource/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sepehrbayat%2Fsimple-chess-opensource/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sepehrbayat%2Fsimple-chess-opensource/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sepehrbayat","download_url":"https://codeload.github.com/sepehrbayat/simple-chess-opensource/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sepehrbayat%2Fsimple-chess-opensource/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28397839,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T14:36:09.778Z","status":"ssl_error","status_checked_at":"2026-01-13T14:35:19.697Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["ai","alpha-beta-pruning","artificial-intelligence","board-game","chess","chess-engine","educational","game-development","game-engine","minimax","open-source","pygame","pygame-tutorial","python","python-game"],"created_at":"2026-01-13T19:48:25.507Z","updated_at":"2026-01-13T19:48:26.424Z","avatar_url":"https://github.com/sepehrbayat.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple Chess - Open Source\n\n[![Python](https://img.shields.io/badge/Python-3.7+-blue.svg)](https://www.python.org/)\n[![Pygame](https://img.shields.io/badge/Pygame-2.5+-green.svg)](https://www.pygame.org/)\n[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\n\n**Author:** Sepehr Bayat\n\nA complete, open-source chess game built with Python and Pygame. Features move quality evaluation, AI opponent with minimax algorithm, and a clean, modular architecture. Perfect for learning chess programming, AI algorithms, and game development.\n\n## 🎮 Features\n\n- **Complete Chess Rules**: All standard chess rules including special moves (castling, en passant, pawn promotion)\n- **Move Quality Scoring**: Each move is evaluated and assigned a score from 0-100 based on material balance, position quality, and move impact\n- **Visual Feedback**: Highlighted valid moves and selected pieces\n- **Game Status**: Real-time display of check, checkmate, and stalemate conditions\n- **AI Opponent**: Play against computer with minimax algorithm and alpha-beta pruning\n- **Multiple Game Modes**: \n  - User vs User (two players)\n  - User vs AI (play as white or black)\n  - AI vs AI (watch computer play)\n- **High-Quality Piece Graphics**: Beautifully drawn chess pieces with shadows and highlights\n- **Custom Piece Images**: Support for custom piece images (falls back to drawn pieces if not available)\n- **Clean Architecture**: Object-oriented design with separate classes for pieces, board, game logic, AI, and evaluation\n\n## 📋 Requirements\n\n- Python 3.7 or higher\n- Pygame 2.5.0 or higher\n- PyInstaller 6.0.0 or higher (optional, for building executable)\n\n## 🚀 Installation\n\n### Quick Setup (Windows)\n\n1. **Clone the repository**\n   ```bash\n   git clone https://github.com/sepehrbayat/simple-chess-opensource.git\n   cd simple-chess-opensource\n   ```\n   \n   Or download the ZIP file from the repository page and extract it.\n\n2. **Run the setup script:**\n   - **PowerShell**: `.\\setup.ps1`\n   - **Command Prompt**: `setup.bat`\n\n   This will:\n   - Check for Python installation\n   - Create a virtual environment\n   - Install all dependencies\n\n### Manual Setup\n\n1. **Install Python 3.7+** from [python.org](https://www.python.org/downloads/)\n   - Make sure to check \"Add Python to PATH\" during installation\n\n2. **Create a virtual environment:**\n   ```bash\n   python -m venv venv\n   ```\n\n3. **Activate the virtual environment:**\n   - **Windows (PowerShell)**: `.\\venv\\Scripts\\Activate.ps1`\n   - **Windows (CMD)**: `venv\\Scripts\\activate.bat`\n   - **Linux/Mac**: `source venv/bin/activate`\n\n4. **Install dependencies:**\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n## 🎯 Running the Game\n\n### Run from Source\n\n**Using the run script:**\n- **PowerShell**: `.\\run.ps1`\n- **Command Prompt**: `run.bat`\n\n**Or manually:**\n```bash\npython main.py\n```\n\n### Build Executable (Windows)\n\nTo create a standalone `.exe` file using PyInstaller:\n\n```bash\npyinstaller --onefile --windowed --name ChessMVP main.py\n```\n\nThe executable will be created in the `dist` folder.\n\n**With icon:**\n```bash\npyinstaller --onefile --windowed --icon=icon.ico --name ChessMVP main.py\n```\n\n## 🎲 How to Play\n\n1. **Select Game Mode**: When the game starts, choose your preferred game mode:\n   - **User vs User**: Play against another person\n   - **User vs AI (White)**: You play as white, computer plays as black\n   - **User vs AI (Black)**: You play as black, computer plays as white\n   - **AI vs AI**: Watch two computer players compete\n\n2. **Select a Piece**: Click on one of your pieces (white moves first)\n\n3. **Make a Move**: Click on a highlighted square to move the selected piece\n\n4. **Move Score**: After each move, the quality score (0-100) is displayed in the side panel\n\n5. **Game Status**: The panel shows the current turn, game status (check/checkmate/stalemate), and move scores\n\n6. **Quit**: Press ESC to exit the game\n\n## 📊 Move Scoring System\n\nThe move evaluation system assigns scores based on:\n\n- **Material Balance** (0-90 points): Value of captured pieces\n- **Position Quality** (0-20 points): Center control and piece activity\n- **Move Impact** (0-15 points): Checks, threats, and strategic value\n\n**Score Interpretation:**\n- **81-100**: Excellent move (major capture, check, strong threat)\n- **61-80**: Good move (gains material, improves position)\n- **31-60**: Neutral move\n- **0-30**: Poor move (loses material, weakens position)\n\n## 🤖 AI Engine\n\nThe AI uses a minimax algorithm with alpha-beta pruning to find the best moves. The default search depth is 3, which provides a good balance between skill and speed.\n\n## 📁 Project Structure\n\n```\nsimple-chess-opensource/\n├── chess/\n│   ├── __init__.py\n│   ├── game.py          # Game class (main loop, rendering, menu)\n│   ├── board.py         # Board class (grid, state management)\n│   ├── pieces.py        # Piece base class + 6 subclasses\n│   ├── evaluator.py     # Evaluator class (heuristic scoring)\n│   ├── ai.py            # AI engine (minimax algorithm)\n│   ├── menu.py          # Game mode selection menu\n│   ├── piece_images.py  # Piece image loader and renderer\n│   └── constants.py    # Colors, dimensions, Unicode symbols\n├── assets/\n│   └── README.md        # Instructions for adding custom piece images\n├── main.py              # Entry point\n├── requirements.txt     # Python dependencies\n├── setup.ps1           # PowerShell setup script\n├── setup.bat            # Batch setup script\n├── run.ps1              # PowerShell run script\n├── run.bat              # Batch run script\n├── LICENSE              # MIT License\n└── README.md           # This file\n```\n\n## 🏗️ Architecture\n\nThe project uses a modular OOP architecture:\n\n- **Piece Hierarchy**: Base `Piece` class with 6 subclasses (Pawn, Rook, Knight, Bishop, Queen, King)\n- **Board**: Manages game state, move validation, and check/checkmate detection\n- **Evaluator**: Calculates move quality scores using heuristic evaluation\n- **AI Engine**: Implements minimax algorithm with alpha-beta pruning for computer player\n- **Game**: Handles Pygame main loop, event handling, UI rendering, and game mode management\n- **Menu**: Provides game mode selection interface\n- **Piece Images**: Loads custom images or generates high-quality drawn pieces\n\n## 🎨 Custom Piece Images\n\nYou can add your own chess piece images to the `assets/` folder. See `assets/README.md` for details.\n\nRequired files:\n- `wp.png`, `wn.png`, `wb.png`, `wr.png`, `wq.png`, `wk.png` (white pieces)\n- `bp.png`, `bn.png`, `bb.png`, `br.png`, `bq.png`, `bk.png` (black pieces)\n\nIf images are not provided, the game will use beautifully drawn pieces with shadows and highlights.\n\n## 🧪 Testing\n\nRun the test suite:\n```bash\npython test_chess.py\n```\n\n## 📝 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## 👤 Author\n\n**Sepehr Bayat**\n\n- **Email**: sepehrbayat5@gmail.com\n- **Telegram**: [@bayatsepehr](https://t.me/bayatsepehr)\n- **LinkedIn**: [linkedin.com/in/sepehrbayat](https://linkedin.com/in/sepehrbayat)\n- **GitHub**: [@sepehrbayat](https://github.com/sepehrbayat)\n\n## 📦 Version\n\nCurrent version: **1.0.0**\n\n## 🌟 Star History\n\nIf you find this project useful, please consider giving it a ⭐ on GitHub!\n\n## 🤝 Contributing\n\nContributions are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.\n\n## 📝 Changelog\n\nSee [CHANGELOG.md](CHANGELOG.md) for a list of changes and version history.\n\n## 🙏 Acknowledgments\n\n- Pygame community for the excellent game development library\n- Chess.com for inspiration and chess rules reference\n- Open source community for continuous support and feedback\n\n## 📞 Contact \u0026 Links\n\n**Sepehr Bayat**\n\n- **Email**: sepehrbayat5@gmail.com\n- **Telegram**: [@bayatsepehr](https://t.me/bayatsepehr)\n- **LinkedIn**: [linkedin.com/in/sepehrbayat](https://linkedin.com/in/sepehrbayat)\n- **GitHub**: [@sepehrbayat](https://github.com/sepehrbayat)\n\n**Project Links:**\n- **Repository**: [simple-chess-opensource](https://github.com/sepehrbayat/simple-chess-opensource)\n- **Issues**: [Report a Bug](https://github.com/sepehrbayat/simple-chess-opensource/issues)\n- **Discussions**: [Join the Discussion](https://github.com/sepehrbayat/simple-chess-opensource/discussions)\n\n---\n\n**Made with ❤️ and Python** | **Enjoy playing Simple Chess!** 🎮♟️\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsepehrbayat%2Fsimple-chess-opensource","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsepehrbayat%2Fsimple-chess-opensource","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsepehrbayat%2Fsimple-chess-opensource/lists"}