Skip to main content

A collection of classic games playable in your terminal

Project description

Terminal Games Collection ๐ŸŽฎ

A collection of classic games playable in your terminal, built with Python.

๐ŸŽฏ Games Included

1. Tic-Tac-Toe

  • Play vs Computer (AI) - Challenge a simple AI opponent
  • Multiplayer (Local Network) - Play with friends on the same WiFi
  • Multiplayer (Global) - Play with anyone worldwide using ngrok

2. Chess โ™Ÿ๏ธ

  • Play against an AI opponent
  • Classic chess with Unicode pieces
  • Standard chess rules and moves

3. Sudoku ๐Ÿ”ข

  • Number puzzle game with three difficulty levels
  • Easy - 40 cells removed
  • Medium - 50 cells removed
  • Hard - 60 cells removed
  • Hints and solution viewer available

4. Text Adventure ๐Ÿ—ก๏ธ

  • Interactive fiction game
  • Explore a fantasy world
  • Solve puzzles and defeat enemies
  • Fight a dragon and find legendary treasure
  • Multiple locations, items, and paths

๐Ÿš€ Getting Started

Installation

Install the package using pip:

pip install t-games

To ensure you have the latest version:

pip install --upgrade t-games

That's it! All dependencies (including python-chess for the Chess game) will be installed automatically.

Running the Games

Main Menu (Recommended)

Launch the main menu to choose any game:

games

Direct Game Launch

Run individual games directly:

tictactoe       # Launch Tic-Tac-Toe directly
chess-game      # Launch Chess directly
sudoku-game     # Launch Sudoku directly
adventure-game  # Launch Text Adventure directly

Development Installation

If you want to contribute or run from source:

  1. Clone the repository:
git clone https://github.com/pavansai-tanguturi/t-games.git
cd t-games
  1. Install in development mode:
pip install -e .

๐ŸŽฎ Game Instructions

Tic-Tac-Toe

  1. Choose your game mode:

    • 1: Play vs Computer
    • 2: Host a game (wait for friend)
    • 3: Join a game (connect to host)
  2. For Network Play:

    • Same WiFi: Host shares their local IP address
    • Different Networks: Use ngrok for global play
      # In a separate terminal:
      ngrok tcp 65432
      
    • Share the ngrok address (e.g., 0.tcp.ngrok.io:12345) with your friend
  3. Enter moves as: row column (e.g., 1 2)

Chess

  • Enter moves in UCI format: e2e4
  • Type exit to quit
  • You play as White (uppercase pieces)
  • AI plays as Black

Sudoku

Commands:

  • move <row> <col> <num> - Place a number (e.g., move 1 1 5)
  • remove <row> <col> - Remove a number
  • hint - Get a hint for an empty cell
  • solution - View the complete solution
  • new <difficulty> - Start a new game (easy/medium/hard)
  • quit - Exit game

Text Adventure

Common Commands:

  • north, south, east, west - Move in directions
  • take <item> - Pick up items
  • talk to <character> - Interact with NPCs
  • fight - Engage in combat
  • use <item> - Use items from inventory
  • inventory or i - Check your items
  • hint - Get location-specific hints
  • help - View available commands
  • quit - Exit game

Tips:

  • Buy a torch early to explore the cave
  • Talk to NPCs for valuable information
  • Collect items and gold throughout your journey
  • The enchanted sword is essential for combat

๐ŸŒ Network Multiplayer Setup

Playing on Same Network (LAN)

  1. Host starts the game and selects "Host"
  2. Host shares their local IP address (displayed in-game)
  3. Client selects "Join" and enters the host's local IP
  4. Play together!

Playing Globally (Different Networks)

Using ngrok:

  1. Download ngrok: https://ngrok.com/download
  2. Host starts the game and selects "Host"
  3. In a separate terminal, run:
    ngrok tcp 65432
    
  4. ngrok will display a forwarding address like:
    Forwarding: tcp://0.tcp.ngrok.io:12345 -> localhost:65432
    
  5. Share the ngrok address with your friend
  6. Client selects "Join" โ†’ "Enter ngrok address" โ†’ enters 0.tcp.ngrok.io:12345
  7. Play together from anywhere in the world!

๐Ÿ“‹ Requirements

  • Python: 3.7 or higher
  • Dependencies: Automatically installed with pip
    • python-chess>=1.9.0 (for Chess game)

All dependencies are managed automatically when you install via pip.

๐ŸŽจ Features

  • Terminal-based UI - No GUI required, runs anywhere Python is installed
  • Cross-platform - Works on Windows, macOS, and Linux
  • Network multiplayer - Play with friends locally or globally
  • Multiple difficulty levels - Suitable for all skill levels
  • Interactive gameplay - Rich text-based experiences
  • Save-free gaming - Jump in and play instantly

๐Ÿ› ๏ธ Technical Details

  • Language: Python 3
  • Network Protocol: TCP sockets for multiplayer
  • Architecture: Modular design with separate game files
  • Input: Text-based command interface

๐Ÿ“ Project Structure

t-games/
โ”œโ”€โ”€ games/            # Main package directory
โ”‚   โ”œโ”€โ”€ __init__.py   # Package initializer
โ”‚   โ”œโ”€โ”€ main.py       # Main launcher with game menu
โ”‚   โ”œโ”€โ”€ tictactoe.py  # Tic-Tac-Toe game with AI and network multiplayer
โ”‚   โ”œโ”€โ”€ chess.py      # Chess game with AI
โ”‚   โ”œโ”€โ”€ sudoku.py     # Sudoku puzzle game
โ”‚   โ””โ”€โ”€ adventure.py  # Text adventure game
โ”œโ”€โ”€ setup.py          # Package configuration
โ”œโ”€โ”€ pyproject.toml    # Build configuration
โ”œโ”€โ”€ requirements.txt  # Python dependencies
โ”œโ”€โ”€ LICENSE           # MIT License
โ””โ”€โ”€ README.md         # This file

๐Ÿ“ฆ PyPI Package

This project is published on PyPI: https://pypi.org/project/t-games/

Install with: pip install t-games

๐Ÿค Contributing

Contributions are welcome! To contribute:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-game)
  3. Commit your changes (git commit -m 'Add amazing game')
  4. Push to the branch (git push origin feature/amazing-game)
  5. Open a Pull Request

๐Ÿ“œ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ”— Links

๐Ÿ‘ฅ Authors

๐ŸŽ‰ Have Fun!

Enjoy playing these classic games in your terminal. Whether you're challenging the AI, playing with friends locally, or connecting globally via ngrok, there's something for everyone!


Made with โค๏ธ using Python

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

t_games-1.0.8.tar.gz (26.6 kB view details)

Uploaded Source

Built Distribution

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

t_games-1.0.8-py3-none-any.whl (22.9 kB view details)

Uploaded Python 3

File details

Details for the file t_games-1.0.8.tar.gz.

File metadata

  • Download URL: t_games-1.0.8.tar.gz
  • Upload date:
  • Size: 26.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.16

File hashes

Hashes for t_games-1.0.8.tar.gz
Algorithm Hash digest
SHA256 bbd7e2b195e84fddaeb6327a5609ee2a09627d68b21bbfd1d70d0d6cd795a565
MD5 64c033e893a117e792f1c8da0699903e
BLAKE2b-256 ab9aba57bd785f45bb76071c02230cad4206b1564329b3cbb58bbf838b79f85d

See more details on using hashes here.

File details

Details for the file t_games-1.0.8-py3-none-any.whl.

File metadata

  • Download URL: t_games-1.0.8-py3-none-any.whl
  • Upload date:
  • Size: 22.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.16

File hashes

Hashes for t_games-1.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 d5dc8b26597d3ac67fb3110f5067d07e39a3a8750d10a5bf15695fe23cb11c98
MD5 dd8e4cebaa038758ca7ad8b2a08d4218
BLAKE2b-256 e36b8eaee400a708c22bf5fd2be38cb83c8c8d06a61c43c4597009524be5c005

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