Skip to content

top-submissions/fullstackjs-tic-tac-toe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

23 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

fullstackjs-tic-tac-toe

A browser-based Tic Tac Toe game built with vanilla JavaScript as part of
The Odin Project โ€“ JavaScript Course (Full Stack JavaScript Path).

This project focuses on organizing JavaScript code using factory functions and the module pattern (IIFE) while maintaining a clean separation between game logic and DOM manipulation.


๐Ÿš€ Live Demo

๐Ÿ‘‰ https://top-submissions.github.io/fullstackjs-tic-tac-toe/


๐Ÿง  About the Project

This is a two-player Tic Tac Toe game playable in the browser.
Players can enter custom names, play multiple rounds, track wins and ties, restart games, and reset scores.

The project was built to practice:

  • Modular JavaScript architecture
  • Avoiding global variables
  • Managing application state
  • DOM interaction without frameworks

โœจ Features

  • Two-player Tic Tac Toe (X vs O)
  • Custom player name input
  • Win detection (rows, columns, diagonals)
  • Tie detection
  • Scoreboard tracking wins and ties
  • Restart game without resetting scores
  • Reset scores button
  • Winning combination highlighting
  • Responsive and modern UI
  • GitHub Pages deployment

๐Ÿ›  Built With

  • HTML5
  • CSS3
  • JavaScript (ES6)
  • Factory Functions
  • Module Pattern (IIFE)
  • DOM Manipulation
  • GitHub Pages

๐ŸŽฎ How to Play

  1. Enter player names (optional).
  2. Click Start Game.
  3. Players take turns clicking empty cells.
  4. First player to align three markers wins.
  5. A tie is declared if the board fills with no winner.
  6. Use Restart Game to play again.
  7. Use Reset Scores to clear the scoreboard.

๐Ÿงฉ JavaScript Architecture

The game is organized into clear modules:

  • GameBoard Module Manages the board state and win/tie detection.

  • Player Factory Creates player objects with name, marker, and score.

  • GameController Module Controls game flow, turn switching, scoring, and win logic.

  • DisplayController Module Handles DOM rendering, UI updates, and user interaction.

This structure follows best practices taught in The Odin Project.


๐Ÿ“š What I Learned

  • Structuring JavaScript projects using modules
  • Separating logic from presentation
  • Managing state without frameworks
  • Writing maintainable, readable code
  • Using GitHub Actions and GitHub Pages

๐Ÿ”ฎ Possible Improvements

  • Single-player mode with AI
  • Difficulty selection
  • Persistent scores using localStorage
  • Sound effects and animations
  • Mobile-first UI refinements

๐Ÿ‘ค Author

MatimotTheTimoters GitHub: https://github.com/Chonky_Seal