Skip to content

codefred-o/demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Tic-Tac-Toe Game

A modern, accessible, and responsive Tic-Tac-Toe game built with vanilla HTML, CSS, and JavaScript.

Features

  • 🎮 Classic Gameplay: Traditional two-player Tic-Tac-Toe
  • Accessibility: Full ARIA support for screen readers
  • ⌨️ Keyboard Navigation: Play using keyboard (Tab, Enter, Space)
  • 📱 Responsive Design: Works seamlessly on desktop and mobile
  • 🎨 Modern UI: Beautiful gradient design with smooth animations
  • 🏆 Visual Feedback: Winning combinations highlighted with animations

How to Play

  1. Player X always goes first
  2. Click on any empty cell to place your mark
  3. Players alternate turns automatically
  4. First player to get 3 marks in a row (horizontal, vertical, or diagonal) wins
  5. If all cells are filled with no winner, it's a draw
  6. Click "Reset Game" to start a new game

Controls

  • Mouse: Click any cell to make a move
  • Keyboard:
    • Tab to navigate between cells
    • Enter or Space to select a cell
    • Tab to the Reset button and press Enter to restart

Technical Details

File Structure

├── index.html      # Main game structure with semantic HTML
├── style.css       # Responsive styling and animations
├── script.js       # Game logic and interactivity
└── README.md       # This documentation

Key Features

Accessibility

  • ARIA labels and roles for screen readers
  • Live regions for game status updates
  • Keyboard navigation support
  • Focus management

Game Logic

  • Object-oriented design with TicTacToe class
  • Win detection for all 8 possible combinations
  • Draw detection when board is full
  • State management for game board and current player

Styling

  • CSS Grid for game board layout
  • CSS animations for winning combinations
  • Responsive design with mobile-first approach
  • Smooth transitions and hover effects

Browser Support

This game works in all modern browsers:

  • Chrome 60+
  • Firefox 55+
  • Safari 12+
  • Edge 79+

Getting Started

  1. Clone or download this repository
  2. Open index.html in your web browser
  3. Start playing!

No build tools or dependencies required - it's pure vanilla web technologies!

Contributing

Feel free to submit issues or pull requests to improve the game. Some ideas for enhancements:

  • AI opponent
  • Score tracking
  • Different board sizes
  • Sound effects
  • Theme customization

License

This project is open source and available under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors