Retour aux Projets

Tic-Tac-Toe

A browser-based Tic-Tac-Toe game built with HTML, CSS, and JavaScript, featuring single-player AI and two-player modes.

2023

Durée

Sep 2023

Taille de l'équipe

1 personnes

Technologies

3+ tech

Tic-Tac-Toe

Aperçu du Projet

A web-based Tic-Tac-Toe game developed with vanilla HTML, CSS, and JavaScript. The game supports both single-player mode against an AI opponent and local two-player mode. The AI uses the minimax algorithm to play optimally, with difficulty levels adjusting the search depth. A save and load feature persists game state to localStorage so players can resume at any time.

Fonctionnalités

  • Classic Tic-Tac-Toe gameplay with a clean, intuitive interface
  • Single-player mode against an AI opponent using the minimax algorithm
  • Two-player mode for competitive local play
  • Multiple AI difficulty levels to suit all players
  • Save and load game functionality via localStorage for resuming play

Défis

  • Implementing a minimax AI that plays optimally in vanilla JavaScript
  • Designing a difficulty system that feels meaningfully different across levels
  • Persisting game state to localStorage cleanly without a backend

Solution

Implemented minimax with alpha-beta pruning for the AI. Difficulty levels reduce the AI's search depth to introduce imperfection at lower settings. Game state is serialized to JSON and stored in localStorage on every move.

Architecture

Single-page vanilla JavaScript application. Game state is managed in a plain JS object. DOM manipulation updates the board after every move. localStorage handles persistence. GitHub Pages hosts the live demo.

Résultats & Impact

  • Live demo playable directly in the browser via GitHub Pages
  • Minimax AI is unbeatable at maximum difficulty
  • Save/load feature works entirely client-side with no backend required
Technologies

Frontend

HTMLCSSJavaScript

Backend

Base de données

localStorage

Outils

GitGitHub Pages
Équipe
  • Ismail ZAHIR
Licence
MIT

Libre d'utilisation, modification et distribution avec attribution.

Tags du Projet
HTMLCSSJavaScript

Plus de Projets

NexoWorld
2024
An AR mobile game where players explore real-world locations to earn in-app currency and complete challenges — built on a Spring Boot microservices backend with real-time location sync.
Spring BootFlutterMongoDB+5
Kolchi.ma
2024
A full-featured Moroccan e-commerce and repair marketplace connecting buyers, sellers, and service providers on a polyglot microservices platform with real-time messaging.
DotNet CoreSpring BootNestJS+6