Tic Tac Toe Game
A classic Tic Tac Toe game built with HTML, CSS, and JavaScript. This interactive web-based game allows two players to play against each other on a 3x3 grid.
Demo
๐ฅ Game Demo Video
โถ๏ธ Watch the Demo Video on Google Drive
Watch the game in action
๐ธ Screenshots
Game Interface
Main game board with clean, responsive design
Winner Announcement
Victory message display
Draw Game
Draw game notification
Features
- Two-player gameplay: Players alternate between โOโ and โXโ
- Win detection: Automatically detects winning patterns
- Draw detection: Recognizes when the game ends in a tie
- Game reset: Reset button to start a new game
- Responsive design: Works on different screen sizes
- Visual feedback: Winner announcement and game status display
Game Rules
- The game is played on a 3ร3 grid
- Player 1 uses โOโ and Player 2 uses โXโ
- Players take turns placing their marks in empty squares
- The first player to get 3 marks in a row (horizontally, vertically, or diagonally) wins
- If all 9 squares are filled without a winner, the game is a draw
File Structure
tic-tac-toe/
โโโ game.html # Main HTML file
โโโ gamestyle.css # Styling for the game
โโโ app.js # Game logic and functionality
โโโ README.md # This file
โโโ images/ # Screenshots and images
โ โโโ images/Game_Interface.png
โ โโโ winner-screen.png
โ โโโ images/gamedraw.png
How to Play
- Open
game.html
in a web browser
- Click on any empty square to place your mark
- Players automatically alternate between โOโ and โXโ
- The game will announce the winner or declare a draw
- Click โReset Gameโ or โNew Gameโ to start over
Technical Details
HTML Structure
- Game board consists of 9 button elements with class โboxโ
- Message container displays game status and winner
- Reset and new game buttons for game control
CSS Features
- Responsive design using
vmin
units
- Flexbox layout for proper alignment
- Attractive color scheme with aqua and teal colors
- Smooth shadows and rounded corners
- Hidden/show classes for message display
JavaScript Functionality
- Event listeners for box clicks and button interactions
- Turn management system
- Win pattern checking algorithm
- Game state management (count, turn tracking)
- Dynamic UI updates
Win Patterns
The game checks for wins in 8 possible combinations:
- Rows: [0,1,2], [3,4,5], [6,7,8]
- Columns: [0,3,6], [1,4,7], [2,5,8]
- Diagonals: [0,4,8], [2,4,6]
Browser Compatibility
This game works in all modern web browsers including:
- Chrome
- Firefox
- Safari
- Edge
Installation
- Download or clone the project files
- Ensure all files are in the proper directory structure
- Open
game.html
in your web browser
- Start playing!
For Contributors
If youโre contributing screenshots or demo videos:
- Add screenshots to the
images/
folder
- Add demo videos/GIFs to the
demo/
folder
- Update the README with new media links
- Use descriptive filenames (e.g.,
mobile-responsive-view.png
)
Screenshots
- Format: PNG or JPG
- Size: Recommended 1200x800px for desktop views
- Mobile: 400x800px for mobile screenshots
- Quality: High resolution, clear text visibgility
Demo Videos
- Format: GIF (for README) or MP4 (for external hosting)
- Duration: 10-30 seconds showing key features
- Size: Keep GIFs under 5MB for GitHub
- Content: Show complete game flow (move, win, reset)
Future Enhancements
Potential improvements could include:
- AI opponent for single-player mode
- Score tracking across multiple games
- Different difficulty levels
- Sound effects
- Animations for moves
- Mobile app version
Contributing
Feel free to fork this project and submit pull requests for any improvements or bug fixes.
License
This project is open source and available under the MIT License.
Enjoy playing Tic Tac Toe! ๐ฎ