A modern, polished Tic-Tac-Toe game built with Flutter. It features a sophisticated AI bot, a dynamic undo system, and a sleek dark-themed UI.
- Game Modes:
- Human vs Human: Classic two-player local multiplayer.
- Human vs Bot: Play against a smart AI with three difficulty levels.
- Bot AI (Autonomous Logic):
- Easy: Makes random moves.
- Medium: Blocks you if you're about to win, otherwise plays randomly.
- Hard: Prioritizes winning moves, blocks your wins, and makes strategic choices.
- Fair Play Logic: The game automatically alternates who starts (X) after every reset.
- Dynamic Undo System:
- Earn "Undo Credits" by making moves.
- Undoing in Bot Mode reverts both the bot's response and your last move.
- Prevented from "undoing" the bot's initial move to maintain fair turn order.
- Premium UI: Sleek dark mode, custom-styled buttons, and smooth board transitions.
- Framework: Flutter
- State Management: Provider
- Logic: Custom autonomous board mechanics and bot simulation.
The bot uses a simulation-based approach to decision making:
- Victory check: It first checks if any available move would result in its own immediate win.
- Block check: It then checks if any player move would result in a player win and blocks it.
- Randomization: If neither condition is met (or for lower difficulty levels), it picks a move at random from the available squares.
- Clone the repository:
git clone https://github.com/your-username/tic_tac_toe.git
- Install dependencies:
flutter pub get
- Run the app:
flutter run
lib/models/board.dart: Pure board state and win/draw logic.lib/models/bot.dart: AI simulation and move selection.lib/models/game.dart: High-level game orchestration (modes, resets).lib/Providers/game_provider.dart: Reactive state management and undo tracking.lib/screens/game_screen.dart: Polished UI and settings.