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.
- client side
main.py
: entry point of the server sideboard.py
: defines theBoard
class, responsible for rendering the GUI, managing game board interactions, and updating game statusclient.py
: contains theClient
class that handles communication with the server
- server side
main.py
: entry point of the client sideserver.py
: defines theServer
class to handle client connections, process game-related requests, and manage the game state and player interactionsdatabase.py
: contains theDatabase
class, which manages player connections, waiting lists, and active gamesgame.py
: contains theGame
class that represents the game state, processes moves, and determines the game outcome
- 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
- 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
)
- Run the client(s) in another terminal:
python src/client/main.py --username <username> [--host <hostname>] [--port <port>]
username
: (required) username for the playerhost
: (optional) hostname of the server (default:localhost
)port
: (optional) port number of the server (default:44444
)