Skip to content
This repository has been archived by the owner on Dec 2, 2024. It is now read-only.
/ tic-tac-toe Public archive

distributed Tic-Tac-Toe game with a PySide6 GUI for the client and a multithreaded server using low-level socket programming

Notifications You must be signed in to change notification settings

mr-yifeiwang/tic-tac-toe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Distributed Tic-Tac-Toe

This repository contains a distributed Tic-Tac-Toe game featuring a graphical user interface (GUI) built with PySide6 on the client side, and a multithreaded server with a thread-per-connection architecture to manage game logic and player communication.

The server maintains the game state in memory without persistent storage.

GUI

Components

  • client side
    • main.py: entry point of the server side
    • board.py: defines the Board class, responsible for rendering the GUI, managing game board interactions, and updating game status
    • client.py: contains the Client class that handles communication with the server
  • server side
    • main.py: entry point of the client side
    • server.py: defines the Server class to handle client connections, process game-related requests, and manage the game state and player interactions
    • database.py: contains the Database class, which manages player connections, waiting lists, and active games
    • game.py: contains the Game class that represents the game state, processes moves, and determines the game outcome

Installation and Usage

  1. Clone this repository and install dependencies:
git clone https://github.com/wille-wang/tic-tac-toe
cd tic-tac-toe
pip install -r requirements.txt
  1. Run the server:
python src/server/main.py [--host <hostname>] [--port <port>]
  • host: (optional) hostname of the server (default: localhost)
  • port: (optional) port number of the server (default: 44444)
  1. Run the client(s) in another terminal:
python src/client/main.py --username <username> [--host <hostname>] [--port <port>]
  • username: (required) username for the player
  • host: (optional) hostname of the server (default: localhost)
  • port: (optional) port number of the server (default: 44444)

About

distributed Tic-Tac-Toe game with a PySide6 GUI for the client and a multithreaded server using low-level socket programming

Topics

Resources

Stars

Watchers

Forks