Skip to main content

Connect 4 game with pygame UI

Project description

Connect 4 (Python + pygame)

https://pypi.org/project/connect4-game/

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.x (3.14+ is not supported yet: pygame 2.6.x hits a font-module circular import on 3.14; see pygame#4795.)
  • 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 https://github.com/appraveen/connect4.git 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)

Ensure you are in python environment 3.13.*

# pip install connect4-game
# connect4

pyenv install 3.13.2   # or latest 3.13.x
pyenv local 3.13.2     # in the project, or: pyenv global 3.13.2
python -m pip install -U connect4-game
connect4

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

connect4_game-0.1.5.tar.gz (18.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

connect4_game-0.1.5-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

Details for the file connect4_game-0.1.5.tar.gz.

File metadata

  • Download URL: connect4_game-0.1.5.tar.gz
  • Upload date:
  • Size: 18.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for connect4_game-0.1.5.tar.gz
Algorithm Hash digest
SHA256 bf7f06f4265228a23ddf969ddb4e62c68aaea248a6df494d221133d70d0aedd6
MD5 dc24133ec9c570727dedb2c538485f17
BLAKE2b-256 f053673b705891459dff4bd79b24492009ecc6d61b73d3b5ab40d137555c9a81

See more details on using hashes here.

File details

Details for the file connect4_game-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: connect4_game-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 21.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for connect4_game-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 090c98fab31b5d719f5ba46cf89b397c0f90e6072259efbafab173f53d89fb14
MD5 30c0f3e7736e6997eacea54eba8c3a18
BLAKE2b-256 6fc0a4e4b214f60757a8e285b3c76f1366c4342b1ec9908e53344c4d162b1df5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page