A web-based Tic-Tac-Toe game built using Laravel and Livewire. Play as two humans or challenge a computer-controlled opponent. Features include dynamic player setup, intelligent computer moves, and live interactivity without page reloads.
- ๐งโ๐คโ๐ง Human vs Human mode
- ๐ค Human vs Computer mode (random and smart moves)
- ๐ง Intelligent move logic for computer opponent
- โ Input validation and error handling
- ๐ Reset game or go back to player selection
- Clone the repository:
git clone https://github.com/AdxStackDev/tic-tac-toe.git
cd tic-tac-toe- Install dependencies:
composer install
npm install && npm run dev- Set up the environment:
cp .env.example .env
php artisan key:generate- Run the app:
php artisan serveThen visit http://localhost:8000/tic-tac-toe in your browser.
-
Player Setup:
- Enter Player 1 name and symbol (
Odefault). - Choose opponent: Human or Computer.
- If Human: Enter Player 2 name and symbol (
Xdefault). - If Computer: Auto-assign
X.
- Enter Player 1 name and symbol (
-
Gameplay:
- Players take turns by clicking grid cells.
- Invalid moves show error messages.
- Game ends when someone wins or itโs a draw.
-
Reset Options:
- Restart game.
- Reset to player selection screen.
โโโ app/Http/Livewire/TicTacToe.php
โโโ resources/views/livewire/tic-tac-toe.blade.php
โโโ routes/web.php
This project is open-source and available under the MIT license.
PRs and suggestions are welcome! If you'd like to contribute AI enhancements or additional difficulty levels, feel free to open an issue or pull request.
Developed by Aditya Dixit โ PHP Developer