Connect 4 game with pygame UI
Project description
Connect 4 (Python + pygame)
Summary
A desktop Connect 4 game with a pygame UI. Game rules, sessions, bots, and the engine live under src/game/; shared types are in src/base_models.py; the public API surface is src/api.py so the UI can depend on stable contracts without importing game/ directly. The pygame front end is under src/ux/. Unit tests cover backend logic under tests/unit/; end-to-end grid scenarios are under tests/e2e/.
Features:
- two players (human or bot)
- bot difficulties (easy / medium / hard)
- player session stats across games
- win-line highlighting
Requirements
- Python 3.13+
- uv (recommended) or another virtualenv + pip workflow
- SDL2 (usually bundled with pygame wheels; on some Linux setups you may need system SDL packages)
Build and run from this repository
From the project root (the directory that contains pyproject.toml):
git clone <repository-url> connect4
cd connect4
uv sync
Run the game using either the installed console script or the module:
uv run connect4
or:
uv run python -m main
Tests and formatting (optional)
uv run pytest
uv run black src tests
5. Run without cloning the code (install from PyPI)
After the package is published to PyPI under the name defined in pyproject.toml (connect4-game), anyone can install and run it without a checkout:
pip install connect4-game
connect4
Use pipx install connect4-game if you prefer an isolated CLI install.
Note: The exact PyPI package name must match what you publish; adjust
pip install …if you choose a different name on PyPI.
If connect4 fails with No module named 'main', reinstall so you get the current console entry point: pip install --upgrade --force-reinstall connect4-game (or reinstall from this repo with uv pip install -e .).
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file connect4_game-0.1.2.tar.gz.
File metadata
- Download URL: connect4_game-0.1.2.tar.gz
- Upload date:
- Size: 18.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a48bb00433315a18ee78b6bd459a52817de7bf8df14aef90d237e66b58f4bca
|
|
| MD5 |
8f626c9d103209aa4fb4bebd14a004ab
|
|
| BLAKE2b-256 |
e1d90a110e550de19d703d7112416ba270135d96c9951a320cb3afd2390b3cc6
|
File details
Details for the file connect4_game-0.1.2-py3-none-any.whl.
File metadata
- Download URL: connect4_game-0.1.2-py3-none-any.whl
- Upload date:
- Size: 21.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d23280052538595d5d8e8e708d3fd9d615982f4ee1c135c97a0dd0ba45287b0
|
|
| MD5 |
150d8a46f2bc030edd86504802501449
|
|
| BLAKE2b-256 |
5cc63a27ff54377558b098b5f127156a042aa8e380f423b8f8e9cde0a8228a96
|