Skip to content

AdxStackDev/tic-tac-toe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ Tic-Tac-Toe Game in Laravel with Livewire

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.


๐Ÿš€ Features

  • ๐Ÿง‘โ€๐Ÿคโ€๐Ÿง‘ 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

๐Ÿ› ๏ธ Tech Stack


๐Ÿงฉ Setup Instructions

  1. Clone the repository:
git clone https://github.com/AdxStackDev/tic-tac-toe.git
cd tic-tac-toe
  1. Install dependencies:
composer install
npm install && npm run dev
  1. Set up the environment:
cp .env.example .env
php artisan key:generate
  1. Run the app:
php artisan serve

Then visit http://localhost:8000/tic-tac-toe in your browser.


๐Ÿ” Game Flow

  1. Player Setup:

    • Enter Player 1 name and symbol (O default).
    • Choose opponent: Human or Computer.
    • If Human: Enter Player 2 name and symbol (X default).
    • If Computer: Auto-assign X.
  2. Gameplay:

    • Players take turns by clicking grid cells.
    • Invalid moves show error messages.
    • Game ends when someone wins or itโ€™s a draw.
  3. Reset Options:

    • Restart game.
    • Reset to player selection screen.

๐Ÿ“‚ Directory Structure

โ”œโ”€โ”€ app/Http/Livewire/TicTacToe.php
โ”œโ”€โ”€ resources/views/livewire/tic-tac-toe.blade.php
โ””โ”€โ”€ routes/web.php

๐Ÿ“œ License

This project is open-source and available under the MIT license.


โœจ Contribution

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.


๐Ÿ™‹ Author

Developed by Aditya Dixit โ€” PHP Developer

About

๐ŸŽฎ A Laravel Livewire-based Tic-Tac-Toe game supporting human vs. human and human vs. computer game-play.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors