Chess
Chess is a chess game (Multiplayer and Singleplayer) written in Flutter using Flame engine
Install / Use
/learn @shenmareparas/ChessREADME
<a href='https://play.google.com/store/apps/details?id=com.shenmareparas.chess'><img alt='Chess App Icon' src="https://github.com/shenmareparas/Chess/assets/112749923/54c38dbd-7a06-416e-8419-09f27654cbcd" width = 250/></a>
♟️ AI Chess - Flutter Chess Game
A feature-rich chess application built with Flutter and Flame engine, offering both single-player AI modes with varying difficulty levels and offline two-player gameplay. The app features beautiful customizable themes, multiple piece styles, and a powerful chess AI powered by the minimax algorithm with alpha-beta pruning.
<a href='https://play.google.com/store/apps/details?id=com.shenmareparas.chess'><img alt='Get it on Google Play' src='https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png' width='300px'/></a>
✨ Features
🎮 Game Modes
- Single Player: Play against an intelligent AI opponent with 5 difficulty levels
- Two Player Mode: Offline multiplayer on the same device
- Side Selection: Choose to play as white, black, or random
- Timed Games: Optional time controls for competitive play
🎨 Customization
- 8 Beautiful Themes: Including Grey, Dark, Amoled, Lewis, Cherry Funk, Sage, Warm Tan, and Jargon Jade
- 7 Piece Themes: Classic, Angular, 8-Bit, Letters, Video Chess, Lewis Chessmen, and Mexico City
- Dark Mode Support: Multiple dark theme options including pure AMOLED black
- Custom Font: Jura font for elegant typography
🎯 Gameplay Features
- Move History: Track all moves throughout the game using Standard Algebraic Notation (SAN)
- Undo/Redo: Take back moves or replay them (configurable)
- Move Hints: Visual indicators for valid moves
- Board Notation: Algebraic notation (a-h, 1-8) coordinates on the board borders
- Sound Effects: Audio feedback for piece movements
- Board Rotation: Automatic board rotation based on turn
- Promotion Handling: Full support for pawn promotion
- Check Detection: Visual indicators for check and checkmate
- Stalemate Detection: Proper game-end condition handling
🤖 AI Features
- 5 Difficulty Levels: From beginner to expert (depth 1-5)
- Minimax Algorithm: With alpha-beta pruning optimization
- Iterative Deepening: Ensures best move ordering
- Quiescence Search: Avoids horizon effect for captures
- Null Move Pruning & LMR: Advanced search optimizations
- Opening Book: Pre-calculated moves for distinct openings
📸 Screenshots
Add your app screenshots here
🛠️ Technologies Used
- Flutter - UI framework
- Flame - 2D game engine for chess board rendering
- Provider - State management
- Shared Preferences - Local data persistence
- Flame Audio - Sound effects
- URL Launcher - External links
📦 Installation
Prerequisites
- Flutter SDK (3.0.0 or higher)
- Dart SDK (3.0.0 or higher)
- Android Studio / Xcode (for mobile development)
- A device or emulator
Steps
-
Clone the repository
git clone https://github.com/shenmareparas/Chess.git cd Chess -
Install dependencies
flutter pub get -
Run the app
flutter run -
Build for production (optional)
# Android flutter build apk --release # iOS flutter build ios --release
📁 Project Structure
lib/
├── main.dart # App entry point
├── model/
│ ├── app_model.dart # Main app state management
│ ├── app_themes.dart # Theme definitions
│ ├── user_preferences.dart # SharedPreferences wrapper
│ └── player.dart # Player enumerations
├── logic/
│ ├── chess_board.dart # Board logic
│ ├── chess_game.dart # Game controller
│ ├── chess_piece.dart # Piece models
│ ├── chess_piece_sprite.dart # Piece rendering
│ ├── shared_functions.dart # Utility functions
│ ├── game_state_storage.dart # History & undo/redo
│ ├── timer_service.dart # Game clocks
│ ├── audio_service.dart # Sound manager
│ └── move_calculation/ # Move validation and AI logic
└── views/
├── main_menu_view.dart # Main menu screen
├── chess_view.dart # Game screen
├── settings_view.dart # Settings screen
└── components/ # Reusable UI components
🧠 AI Algorithm
The chess AI uses the Minimax algorithm with alpha-beta pruning to determine optimal moves:
How It Works
- Minimax Algorithm: Evaluates the game tree by simulating moves and counter-moves
- Alpha-Beta Pruning: Optimizes search by eliminating branches that won't affect the final decision
- Advanced Optimizations: Utilizes Quiescence Search, Null Move Pruning, and Late Move Reductions (LMR)
- Depth-Based Difficulty:
- Level 1: Depth 1 (1 half-move lookahead)
- Level 2: Depth 2 (1 full move)
- Level 3: Depth 3 (1.5 full moves)
- Level 4: Depth 4 (2 full moves)
- Level 5: Depth 5 (2.5 full moves)
Position Evaluation
The AI evaluates positions based on:
- Material advantage (piece values)
- Piece positioning and mobility
- King safety
- Pawn structure
- Control of center squares
Learn more: Alpha-Beta Pruning on Wikipedia
⚙️ Configuration
The app stores user preferences locally using SharedPreferences:
- Selected theme
- Piece theme preference
- Move history visibility
- Sound settings
- Hint display settings
- Board Rotation preference
- Board Notation visibility
- Undo/Redo availability
🎯 Usage
- Start a New Game: From the main menu, configure your game settings
- Select Mode: Choose between 1-player (vs AI) or 2-player mode
- Choose Difficulty: For AI games, select from 5 difficulty levels
- Customize: Pick your preferred theme and piece style
- Play: Tap pieces to select them, then tap valid squares to move
🤝 Contributing
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📝 License
This project is licensed under the MIT License.
👨💻 Author
Paras Shenmare
- GitHub: @shenmareparas
- Google Play: Download Chess
🙏 Acknowledgments
- Chess piece graphics from various open-source sets
- Jura font by Daniel Johnson
- Flutter and Flame communities
📞 Support
If you encounter any issues or have suggestions, please open an issue.
⭐ If you like this project, please give it a star on GitHub!
Related Skills
node-connect
341.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
341.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
84.4kCommit, push, and open a PR
