Skip to content

A classic Tic-Tac-Toe game built with React. Features include real-time game updates, player name customization, game history tracking, and theme selection. Fully responsive and easy to play!

License

Notifications You must be signed in to change notification settings

TheUzair/Tic-Tac-Toe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

6 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ Modern Tic-Tac-Toe Game

A feature-rich, responsive Tic-Tac-Toe game built with React and Tailwind CSS, featuring multiple themes, player customization, game history tracking, and persistent storage.

Deployment

๐ŸŒŸ Features

๐ŸŽฏ Core Gameplay

  • Classic 3x3 Tic-Tac-Toe mechanics
  • Two-player turn-based system
  • Win detection with highlighted winning line
  • Draw detection when the board is full
  • Game timer tracking match duration
  • Reset game to start fresh

โšก Advanced Features

๐ŸŽญ Customizable Player Names

  • Set custom Player X and O names
  • Names persist across sessions

๐Ÿ•’ Game History & Time Travel

  • Complete move history with timestamps
  • Jump to any previous game state
  • Sort moves (Ascending/Descending)
  • History persists across sessions

๐Ÿ“Š Statistics Tracking

  • Tracks win counts for both players
  • Tracks total draws
  • Persistent across browser sessions

๐ŸŽจ Theme System

Choose from three visually distinct themes:

  1. Light Theme โ€“ Clean, modern UI with blue accents
  2. Dark Theme โ€“ Dark mode for reduced eye strain
  3. Colorful Theme โ€“ Vibrant gradient backgrounds

๐Ÿ› ๏ธ Technical Features

  • Fully responsive (mobile-first)
  • Local Storage Integration for persistence
  • Modular component-based architecture
  • Optimized re-renders for smooth UI
  • Accessibility-friendly design

๐Ÿ—๏ธ Technology Stack

Tech Usage
React 18 Frontend framework
Tailwind CSS Styling & theming
Lucide React, Material UI Icons
Vite Fast build tool
React Hooks State management
Local Storage API Persistent data

๐Ÿ“ Project Structure

src/
 โ”œโ”€โ”€ components/
 โ”‚   โ”œโ”€โ”€ GameBoard.jsx     # Main game grid
 โ”‚   โ”œโ”€โ”€ GameHistory.jsx   # Move history
 โ”‚   โ”œโ”€โ”€ GameSettings.jsx  # Settings panel
 โ”‚   โ”œโ”€โ”€ GameStatistics.jsx     # Win & draw tracking
 โ”‚   โ”œโ”€โ”€ Header.jsx        # Application header
 โ”‚   โ””โ”€โ”€ Footer.jsx        # Application footer
 โ”œโ”€โ”€ App.jsx               # Main application
 โ”œโ”€โ”€ App.css               # Global styles
 โ””โ”€โ”€ index.js              # Entry point

๐Ÿš€ Getting Started

๐Ÿ”ง Prerequisites

Ensure you have Node.js (v22 or higher) installed.

๐Ÿ“ฅ Installation

  1. Clone the repository:

    git clone https://github.com/TheUzair/tic-tac-toe.git
    cd tic-tac-toe
  2. Install dependencies:

    npm install   # or yarn install
  3. Start the development server:

    npm run dev   # or yarn dev
  4. Open in browser:

    http://localhost:5173
    

๐ŸŽฎ How to Play

  • Start Game: Player X begins
  • Make a Move: Click an empty square
  • Alternate Turns: Players take turns placing marks
  • Win: Get three in a row (horizontal, vertical, or diagonal)
  • Game Features:
    • Customize player names
    • Toggle between themes
    • View and navigate move history
    • Reset game anytime

๐Ÿ’พ Persistent Storage

The game automatically saves:
โœ… Player Names
โœ… Game Statistics
โœ… Selected Theme
โœ… Move History

๐ŸŽจ Customization

๐Ÿ–Œ๏ธ Modify Themes

Edit src/utils/theme.js to:

  • Adjust colors & backgrounds
  • Change button styles
  • Modify card layouts

โš™๏ธ Customize Game Settings

Modify GameSettings.jsx to:

  • Adjust player name constraints
  • Add new themes
  • Modify default settings

๐Ÿ”ง Development

๐Ÿ“œ Available Scripts

npm run dev       # Start development server
npm run build     # Build for production
npm run preview   # Preview production build
npm run lint      # Run ESLint

๐Ÿ› ๏ธ Adding Features

  1. Create a new component in src/components
  2. Add utility functions in src/utils if needed
  3. Import and integrate into App.jsx
  4. Update the README accordingly

๐Ÿค Contributing

  1. Fork the repository
  2. Create a branch (git checkout -b feature/AmazingFeature)
  3. Commit changes (git commit -m 'Add AmazingFeature')
  4. Push to branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“œ License

Distributed under the MIT License. See LICENSE for details.

๐Ÿ‘ Acknowledgments

  • React.js โ€“ The amazing framework
  • Tailwind CSS โ€“ Utility-first styling
  • Lucide React โ€“ Elegant icons
  • The Open Source Community โ€“ For inspiration and contributions

About

A classic Tic-Tac-Toe game built with React. Features include real-time game updates, player name customization, game history tracking, and theme selection. Fully responsive and easy to play!

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published