Skip to content

matbalez/tic-tac-toe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

4x4 Tic Tac Toe - Client-Server Edition

A modern 4x4 Tic Tac Toe game with client-server architecture where the AI logic runs on the server.

Architecture

  • Client: HTML/CSS/JavaScript frontend that handles UI and user interactions
  • Server: Node.js/Express backend that handles AI logic and game computations

Setup & Running

1. Install Server Dependencies

cd server
npm install

2. Start the Server

npm start
# or for development with auto-reload:
npm run dev

The server will run on http://localhost:3000

3. Open the Game

Open index.html in your browser, or serve it from the server at http://localhost:3000

Features

  • 4x4 Grid: Win by getting 4 in a row (horizontal, vertical, or diagonal)
  • Smart AI: Computer player uses minimax algorithm with optimizations
  • Server-Side AI: All computer logic runs on the backend
  • Fallback Mode: Client falls back to random moves if server is unavailable
  • Responsive Design: Works on desktop and mobile devices
  • Visual Feedback: Animations, win highlighting, and status updates

API Endpoints

  • POST /api/computer-move - Get the computer's next move
  • POST /api/check-game-state - Check current game state
  • GET /api/health - Server health check

Game Rules

  • Player X (human) goes first
  • Win by getting 4 symbols in a row, column, or diagonal
  • Game ends in a tie if the board fills without a winner

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •