A Tic-Tac-Toe game built using React.js, TypeScript, and Tailwind CSS.
- Interactive 3x3 game board
- Two-player gameplay (X and O)
- Real-time winner detection
- Draw game detection
- Game reset functionality
- Responsive design with Tailwind CSS
- Clean and modern UI
- React.js, TypeScript, and Tailwind CSS for the frontend
- Vite as the build tool
src/
├── components/
│ ├── Board.tsx # Main game board component
│ └── Square.tsx # Individual square component
├── App.tsx # Main application component
├── main.tsx # Application entry point
└── index.css # Global styles
- Clone the repository:
git clone <repository-url>
cd tic-tac-toe- Install dependencies:
npm install- Start the development server:
npm run dev- Open your browser and navigate to
http://localhost:5173
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run lint- Run ESLint
- Click "Start Game" to begin
- Players take turns clicking on empty squares
- Player X goes first, followed by Player O
- The first player to get three of their marks in a row (horizontally, vertically, or diagonally) wins
- If all squares are filled without a winner, the game ends in a draw
- Click "Reset" to start a new game
The game implements these winning combinations:
- Horizontal: [1,2,3], [4,5,6], [7,8,9]
- Vertical: [1,4,7], [2,5,8], [3,6,9]
- Diagonal: [1,5,9], [3,5,7]
Main application component that manages the game state and renders the start screen or game board.
Core game component that handles:
- Game state management
- Player turns
- Winner detection
- Draw detection
- Square click handling
Individual square component that represents each cell in the 3x3 grid.
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and linting
- Submit a pull request
This project is open source and available under the MIT License.
