Skip to main content

A collection of classic arcade games including Snake, Tetris, Arkanoid, and Pac-Man

Project description

Game Collection

A collection of classic arcade games including Snake, Tetris, Arkanoid, and Pac-Man, built with Python and Pygame.

Features

  • Snake: Classic snake game with growing mechanics
  • Tetris: Block-stacking puzzle game with line clearing
  • Arkanoid: Breakout-style game with paddle and ball physics
  • Pac-Man: Maze navigation game with dots and ghosts

Installation

From Source

# Clone the repository
git clone <repository-url>
cd game-collection

# Install in development mode
pip install -e .

# Or install with development dependencies
pip install -e ".[dev]"

From PyPI (when published)

pip install game-collection

Usage

Command Line

After installation, you can run the game collection using:

# Using the entry point
game-collection

# Or using Python module
python -m game

Development

# Run the game
make run

# Run tests
make test-unit

# Run tests with coverage
make test-cov

# Check code quality
make quality

# Build executable
make build

# Setup pre-commit hooks
make pre-commit-install

# Run pre-commit on all files
make pre-commit-run

# Check readiness for PyPI publication
make publish-check

# Publish to TestPyPI (for testing)
make publish-test

# Publish to PyPI (requires API token)
make publish

Debug Features

The game includes a debug overlay that can be toggled during gameplay:

  • F1: Toggle debug overlay on/off
  • F2: Reset FPS history
  • F3: Toggle fullscreen mode

The debug overlay shows:

  • Real-time FPS and FPS history
  • Current game and state
  • Mouse position
  • Currently pressed keys
  • Performance statistics

Configuration

The game uses a configuration system that stores settings in platform-appropriate directories:

  • Windows: %APPDATA%/GameCollection/
  • macOS: ~/Library/Application Support/GameCollection/
  • Linux: ~/.local/share/GameCollection/

Configuration Files

  • config.json: Game settings, controls, audio, and difficulty levels
  • scores.json: High scores for all games

Configuration Options

The configuration includes:

  • Display: Resolution, fullscreen mode, FPS
  • Controls: Key mappings for each game
  • Game Settings: Speed, grid size, lives, etc.
  • Audio: Volume levels and enable/disable
  • Difficulty: Easy, Normal, Hard presets

Development

Project Structure

src/
├── game/
│   ├── __init__.py
│   ├── __main__.py          # Entry point
│   ├── main.py              # Main game loop
│   ├── config.py            # Configuration management
│   ├── config.json          # Default configuration
│   ├── games/               # Game implementations
│   │   ├── base.py          # Base game class
│   │   ├── logic.py         # Pure game logic functions
│   │   ├── snake.py         # Snake game
│   │   ├── tetris.py        # Tetris game
│   │   ├── arkanoid.py      # Arkanoid game
│   │   └── pacman.py        # Pac-Man game
│   └── ui/                  # User interface
│       ├── menu.py          # Main menu
│       └── scores.py        # Score management
tests/                       # Unit tests
docs/                        # Documentation

Testing

The project includes comprehensive unit tests for all game logic:

# Run all tests
python -m pytest tests/

# Run specific test file
python -m pytest tests/test_tetris_logic.py

# Run with coverage
python -m pytest tests/ --cov=src/game/games --cov-report=html

Code Quality

The project uses modern Python tooling:

  • Ruff: Fast linting and formatting
  • MyPy: Static type checking
  • Pytest: Testing framework
  • Appdirs: Platform-appropriate data directories

Building Executables

# Build with PyInstaller
make build

# Or manually
pyinstaller --onefile --windowed --name GameCollection src/game/__main__.py

Requirements

  • Python 3.10+
  • Pygame 2.5.0+
  • Appdirs 1.4.4+ (for data directory management)

Development Requirements

  • Ruff 0.1.0+ (linting and formatting)
  • MyPy 1.8.0+ (type checking)
  • Pytest 7.4.0+ (testing)
  • PyInstaller 5.13.0+ (executable building)

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run the quality checks: make quality
  5. Submit a pull request

License

MIT License - see LICENSE file for details.

Changelog

See CHANGELOG.md for a detailed list of changes.

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

game_collection-1.1.1.tar.gz (41.2 kB view details)

Uploaded Source

Built Distribution

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

game_collection-1.1.1-py3-none-any.whl (44.2 kB view details)

Uploaded Python 3

File details

Details for the file game_collection-1.1.1.tar.gz.

File metadata

  • Download URL: game_collection-1.1.1.tar.gz
  • Upload date:
  • Size: 41.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for game_collection-1.1.1.tar.gz
Algorithm Hash digest
SHA256 824b92beeeaeb14f1f78569861ffebddfc85a9dd034ba075cf13f7ab1296d128
MD5 5c2e8e967f2e008da746c984a8ca7671
BLAKE2b-256 4b6fec25aa2df425502c1e57c02daa47e3f309a060081f630d822d695fb97c6c

See more details on using hashes here.

File details

Details for the file game_collection-1.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for game_collection-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b29b1c90ad9b0cb1d0e255089a0a28a27f6d9be781ed6a8ee5a2a9a33c001d50
MD5 93edee57e2d0110d227021365f8efdfa
BLAKE2b-256 26c2ff0256ecac5b24e3d0de21843f23b9a83b2a576c69ccd6347d4f65611848

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