Skip to content

Latest commit

ย 

History

History
113 lines (83 loc) ยท 3.32 KB

File metadata and controls

113 lines (83 loc) ยท 3.32 KB

XO Game - Modern Tic-Tac-Toe

A beautifully designed, cross-platform Tic-Tac-Toe game built with Flutter. This modern implementation features sleek animations, haptic feedback, sound effects, theme switching, and persistent scoring.

Features

  • ๐ŸŽฎ Clean, responsive UI for both mobile and desktop platforms
  • ๐ŸŽฏ Smooth animations for game pieces and winning lines
  • ๐ŸŒ“ Light and dark theme support with persistent preference
  • ๐Ÿ”Š Sound effects with toggle control
  • ๐Ÿ“ฑ Haptic feedback on mobile devices
  • ๐Ÿ“Š Score tracking with persistent storage
  • ๐Ÿ’ป Optimized for desktop with proper window management
  • ๐Ÿ† Winning line animation
  • ๐Ÿ”„ Game state management using Provider

Getting Started

Prerequisites

  • Flutter SDK (latest stable version recommended)
  • Dart SDK
  • Android Studio, VS Code, or another IDE with Flutter support

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/xo_game.git
    cd xo_game
  2. Install dependencies:

    flutter pub get
  3. Run the app:

    flutter run

Project Structure

lib/
โ”œโ”€โ”€ main.dart                 # Application entry point
โ”œโ”€โ”€ screens/
โ”‚   โ””โ”€โ”€ game_screen.dart      # Main game screen
โ”œโ”€โ”€ providers/
โ”‚   โ”œโ”€โ”€ game_state.dart       # Game logic and state management
โ”‚   โ””โ”€โ”€ theme_provider.dart   # Theme state management
โ”œโ”€โ”€ theme/
โ”‚   โ”œโ”€โ”€ app_colors.dart       # Color definitions
โ”‚   โ””โ”€โ”€ app_theme.dart        # Theme configurations
โ”œโ”€โ”€ utils/
โ”‚   โ”œโ”€โ”€ platform_utils.dart   # Platform-specific utilities
โ”‚   โ””โ”€โ”€ window_manager.dart   # Desktop window management
โ””โ”€โ”€ widgets/
    โ”œโ”€โ”€ animated_game_cell.dart   # Individual game cell with animations
    โ”œโ”€โ”€ game_board.dart           # Complete game board
    โ””โ”€โ”€ winning_line_painter.dart # Custom painter for winning line

Game Play

  1. The game starts with Player X
  2. Players take turns marking empty cells on the 3x3 grid
  3. The first player to get three of their marks in a row (horizontally, vertically, or diagonally) wins
  4. If all cells are filled and no player has three in a row, the game ends in a draw
  5. The score is tracked across multiple games
  6. Use the "New Game" button to reset the board and start a new round

Customization

Themes

The app comes with both dark and light themes. The theme preference is saved between sessions. Toggle the theme by clicking the sun/moon icon in the top right corner.

Sound Effects

Sound effects can be toggled on/off through the settings dialog. The preference is saved between sessions.

Platform Support

  • ๐Ÿ“ฑ Android
  • ๐Ÿ“ฑ iOS
  • ๐Ÿ’ป Windows
  • ๐Ÿ’ป macOS
  • ๐Ÿ’ป Linux
  • ๐ŸŒ Web (limited functionality)

Dependencies

  • provider: For state management
  • shared_preferences: For persistent storage
  • window_manager: For desktop window management
  • audioplayers: For sound effects
  • vibration: For haptic feedback

Contributing

Contributions are welcome! Feel free to submit a pull request or create an issue for any bugs or feature requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Flutter team for the amazing framework
  • The open-source community for inspirational game implementations