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. Battleship 🚢
- Classic naval combat game
- Place your ships strategically
- Sink all enemy ships to win
- Side-by-side board display
5. 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
Prerequisites
- Python 3.7 or higher
- pip (Python package manager)
Installation
- Clone or download this repository:
cd t-games
- Install required dependencies:
pip install -r requirements.txt
Running the Games
Option 1: Main Menu (Recommended)
Launch the main menu to choose any game:
python main.py
Option 2: Direct Game Launch
Run individual games directly:
python tictactoe.py
python chess.py
python sudoku.py
python battleship.py
python adventure.py
🎮 Game Instructions
Tic-Tac-Toe
-
Choose your game mode:
- 1: Play vs Computer
- 2: Host a game (wait for friend)
- 3: Join a game (connect to host)
-
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
-
Enter moves as:
row column(e.g.,1 2)
Chess
- Enter moves in UCI format:
e2e4 - Type
exitto 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 numberhint- Get a hint for an empty cellsolution- View the complete solutionnew <difficulty>- Start a new game (easy/medium/hard)quit- Exit game
Battleship
- Place your ships on the grid
- Enter coordinates to fire at enemy ships
- First to sink all enemy ships wins
Text Adventure
Common Commands:
north,south,east,west- Move in directionstake <item>- Pick up itemstalk to <character>- Interact with NPCsfight- Engage in combatuse <item>- Use items from inventoryinventoryori- Check your itemshint- Get location-specific hintshelp- View available commandsquit- 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)
- Host starts the game and selects "Host"
- Host shares their local IP address (displayed in-game)
- Client selects "Join" and enters the host's local IP
- Play together!
Playing Globally (Different Networks)
Using ngrok:
- Download ngrok: https://ngrok.com/download
- Host starts the game and selects "Host"
- In a separate terminal, run:
ngrok tcp 65432
- ngrok will display a forwarding address like:
Forwarding: tcp://0.tcp.ngrok.io:12345 -> localhost:65432 - Share the ngrok address with your friend
- Client selects "Join" → "Enter ngrok address" → enters
0.tcp.ngrok.io:12345 - Play together from anywhere in the world!
📋 Requirements
- Python Standard Library:
os,sys,random,copy,socket,time - External Package:
python-chess>=1.9.0(for Chess game only)
All dependencies are listed in requirements.txt
🎨 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/
├── main.py # Main launcher with game menu
├── tictactoe.py # Tic-Tac-Toe game
├── chess.py # Chess game
├── sudoku.py # Sudoku puzzle game
├── battleship.py # Battleship game
├── adventure.py # Text adventure game
├── requirements.txt # Python dependencies
└── README.md # This file
🤝 Contributing
Feel free to fork this project and add your own games or improvements!
📜 License
This project is open source and available for educational and personal use.
🎉 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
Release history Release notifications | RSS feed
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 t_games-1.0.0.tar.gz.
File metadata
- Download URL: t_games-1.0.0.tar.gz
- Upload date:
- Size: 24.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6c893a33dde81669a639546f1c74eb03debdc600d386083325b7eb6ec95279c
|
|
| MD5 |
d8bf36e2be4090a9bb1ec989e8df2ec9
|
|
| BLAKE2b-256 |
df2220f09b7b0e0a64a6d467c8402dedae0c0bedfed65bccf52f4ceb3e3c4cca
|
File details
Details for the file t_games-1.0.0-py3-none-any.whl.
File metadata
- Download URL: t_games-1.0.0-py3-none-any.whl
- Upload date:
- Size: 22.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ba180ec061f67e5834392ab2faeeadbcc81547c63ea8145e493e2b3ac900ed0
|
|
| MD5 |
477320152dacbeae36aa929b7556db4c
|
|
| BLAKE2b-256 |
7b43c8904f7b697681a8405163329170b66767367e719dd1cfa152634b7336f0
|