|
| 1 | +# Card Game War |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | +## 🎮 Overview |
| 10 | + |
| 11 | +Welcome to the Card Game War project! This project provides a secure, cross-platform implementation of the classic card game "War" with a graphical interface and encrypted results storage. |
| 12 | + |
| 13 | + |
| 14 | +**How it works:** |
| 15 | +- Key files (`war.py`, etc.) are obfuscated and require the `pyarmor_runtime_007668` runtime folder to run. |
| 16 | +- The runtime is included in the project and loaded automatically. |
| 17 | +- This helps protect your code and intellectual property. |
| 18 | + |
| 19 | +**How to use:** |
| 20 | +- Run scripts as usual (e.g., `python war.py`). |
| 21 | +- Do not delete or move the `pyarmor_runtime_007668` folder. |
| 22 | + |
| 23 | + |
| 24 | +| File | Purpose | |
| 25 | +|---------------------|------------------------------------------------------------------------| |
| 26 | +| `war.py` | Main GUI for playing War. Handles game logic, encryption, user input. Obfuscated with Pyarmor.| |
| 27 | +| `generate_key.py` | Generates a secure Fernet key for encrypting results. | |
| 28 | +| `decrypt_results.py`| Decrypts and reads the encrypted results file. | |
| 29 | +| `win-results.json` | Stores encrypted game results. | |
| 30 | +| `win-results.key` | Stores the Fernet encryption key. | |
| 31 | + |
| 32 | +## 🚀 How to Use |
| 33 | + |
| 34 | + |
| 35 | +### 1️⃣ Setup |
| 36 | +1. **Install Python 3.8+** |
| 37 | + |
| 38 | +#### 🪟 Windows |
| 39 | +- Download Python from the official website: [python.org/downloads](https://www.python.org/downloads/windows/) |
| 40 | +- Run the installer and check "Add Python to PATH" during setup. |
| 41 | +- Verify installation: |
| 42 | + ```powershell |
| 43 | + python --version |
| 44 | + ``` |
| 45 | +
|
| 46 | +
|
| 47 | +#### 🐧 Linux |
| 48 | +- Most Linux systems already come with Python pre-installed. You can use the default version that comes with your distribution. |
| 49 | +- To check your Python version: |
| 50 | + ```bash |
| 51 | + python3 --version |
| 52 | + ``` |
| 53 | +- If you need to install or upgrade Python, use your package manager (example for Ubuntu/Debian): |
| 54 | + ```bash |
| 55 | + sudo apt update |
| 56 | + sudo apt install python3 python3-pip |
| 57 | + python3 --version |
| 58 | + ``` |
| 59 | +
|
| 60 | +#### 🍎 macOS |
| 61 | +- Download Python from [python.org/downloads](https://www.python.org/downloads/macos/) |
| 62 | +- Or use Homebrew: |
| 63 | + ```bash |
| 64 | + brew install python |
| 65 | + python3 --version |
| 66 | + ``` |
| 67 | +
|
| 68 | +2. Install required packages: |
| 69 | + ```bash |
| 70 | + pip install -r requirements.txt |
| 71 | + ``` |
| 72 | +
|
| 73 | +### 2️⃣ Generate Encryption Key |
| 74 | +Run the key generator: |
| 75 | +```bash |
| 76 | +python generate_key.py |
| 77 | +``` |
| 78 | + |
| 79 | + |
| 80 | +### 3️⃣ Play the Game |
| 81 | +Start the GUI: |
| 82 | +```bash |
| 83 | +python war.py --gui |
| 84 | +``` |
| 85 | + |
| 86 | +### 🖥️ Play the Console Version |
| 87 | +To play the classic text-based version in your terminal: |
| 88 | +```bash |
| 89 | +python war.py |
| 90 | +``` |
| 91 | + |
| 92 | +### 4️⃣ View Results |
| 93 | +Decrypt and view results: |
| 94 | +```bash |
| 95 | +python decrypt_results.py |
| 96 | +``` |
| 97 | + |
| 98 | + |
| 99 | +## 🖥️ Windows Quick Start |
| 100 | +Double-click `run.bat` to: |
| 101 | +- Generate the key (if missing) |
| 102 | +- Choose to play the GUI or Console version from a menu |
| 103 | + |
| 104 | +## 🏁 Cross-Platform Support |
| 105 | +All `.py` files use `os` and `sys` for path handling and are compatible with Windows, macOS, and Linux. No platform-specific code is used. |
| 106 | + |
| 107 | +## 📝 Notes |
| 108 | +- Make sure `win-results.key` and `win-results.json` are in the same directory as the scripts. |
| 109 | +- For Linux/macOS, use the same commands in your terminal. |
| 110 | + |
| 111 | +--- |
| 112 | +Made with ❤️ by the BubblesTheDev! |
| 113 | + |
0 commit comments