Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TicTacToe

A web-based Tic-Tac-Toe application featuring different game rules, local play, and real-time multiplayer functionality.


Overview ✨

About

This project is a collection of Tic-Tac-Toe variations built to practice full-stack development. It combines a JavaScript-based front-end with a Python back-end to handle real-time game states across different clients. Players can test different game modes against an AI, locally on one device, or online against others.

Check out the live version.


preview

Technologies

Languages:

  • HTML 5
  • CSS 3
  • JavaScript
  • Python 3.11

Libraries and frameworks:

Features

Game Rules & Modes

  • Multiple Rulesets: Play the Standard game (connect a line to win) or Reversed (avoid making a line).
  • Game Variations:
    • Normal: The classic 3x3 experience.
    • Movable: Players move their existing marks on the grid after a certain limit is reached.
    • One Mark: A simplified version using only one mark per player.
  • Customization: Adjustable board sizes, starting player selection, and player icons.

Ways to Play

  • AI Opponent: Play solo against a basic computer player.
  • Local Play: Two players can play on the same device.
  • Online Multiplayer: Real-time matches via WebSockets, including a public lobby and private, password-protected rooms.

Additional Functionality

  • State Management: Automatic handling of player disconnections in online rooms.
  • Localization: Full UI support for both English and Polish.

Details 📜

User interface

Every page

On every page there is:

  • Header:
    • Title which is a link to the main menu page
    • Language selection box that allows the user to change the language of the page without reloading
  • Footer
    • Link to my github

Main menu

main menu Main menu is basically a form for creating a game.

Click on the multiplayer option will take the player to the multiplayer lobby.
Click on the back option will take the player to the previous step.

create game Creating a game is a 3-step form:

  1. Enemy (AI or player on the same device) and game mode
  2. Starting player and type of game (standard, reversed)
  3. Board size, players marks, changing sides every game

Multiplayer lobby

multiplayer lobby The lobby shows all existing games in the form of a list of rooms that the player can join or create a new one. When there is no players in the room, the room is deleted. If the room is full player can't join until some place becomes available. In that case the join button is disabled. Rooms protected by password has a join button with a lock icon. After clicking it player has to put the correct password in order to join to the game.

Each of the rooms in the lobby has:

  • Unique ID
  • Name consisting of:
    • Mode
    • Players marks
    • Board size
    • Type of a game
  • Number of players in the room
  • Join button

multiplayer create game

Creating a game is similar to creating a game in the main menu. The difference is that it is packed in one form and has option for setting password.

Player has to choose:

  • Game mode
  • Board size
  • Type (uncheck = standard, check = reversed)
  • Password (empty = no password)
  • Players marks
  • Starting player
  • Switching sides every game

Game

In game view has:

  • Message info (player's turn, waiting for player in mulitplayer)
  • Players info (marks of the players, which player is the user)
  • Game board (with line in column, row or diagonal if one of the players win)
  • Game info (name, marks, board size, type)
  • Quit and Replay buttons (replay button is disabled until the game is over)

Normal game

normal game Normal version of the tic tac toe, users puts their marks and try to make or avoid making a line depending on game type.


Movable game

movable game In beginning players puts their mark like in normal game but after some moves they can't put more marks and they have to move already placed marks. The game has moves limit which is reached results in a draw.


One mark game

one mark game Similar to normal version but both of the players have the same mark.

Multiplayer game

multiplayer game

Games in multiplayer are the same as normal games, the only differences are:

  • Position of a player will be hilighted in red color if there is no given player or the player left the game
  • If there is no enemy player the game will be stopped on unactive player turn.
  • On the bottom there is a room id and button to copy invitation link.

Password in invitation link is passed in the URL. When both players leave the game, the room and its game is deleted.

About

Three tic-tac-toe versions in two modes. Playable vsvs AI, vs player locally and multiplayer in real-time

Resources

Stars

1 star

Watchers

1 watching

Forks

Used by

Contributors

Languages