Files
morse-trainer/README.md
Irinel Sarbu 3f98712766 first commit
2025-11-21 13:03:06 +01:00

170 lines
4.2 KiB
Markdown

# Morse Code Practice Game 🎮
A terminal-based morse code practice game built with Deno. Improve your morse code translation skills through interactive gameplay with multiple difficulty levels and comprehensive statistics tracking.
## Features
- **Multiple Difficulty Modes**
- 🟢 Easy: Single letters (A-Z)
- 🟡 Medium: Single numbers (0-9)
- 🟣 Hard: Common words
- 🔴 Expert: Short phrases
- **Interactive TUI Interface**
- Beautiful terminal UI with colors and tables
- Real-time timer for each round
- Immediate feedback on answers
- Progress tracking with streak counter
- **Statistics Tracking**
- Overall accuracy and performance metrics
- Mode-specific statistics
- Best streak tracking
- Historical game data
- Average time per round
- **Flexible CLI**
- Interactive menu mode (default)
- Quick play mode with command-line arguments
- Stats viewer
- Built-in morse code reference
## Installation
Make sure you have [Deno](https://deno.land/) installed.
```bash
# Clone or download this repository
cd morse-game
# Make the script executable (optional)
chmod +x main.ts
```
## Usage
### Interactive Mode (Default)
Run the game and navigate through the menu:
```bash
deno task start
# or
deno run --allow-read --allow-write --allow-env main.ts
```
### Quick Play Mode
Start a game directly with custom settings:
```bash
# Play 5 rounds of letters mode with 20 seconds per round
deno task start play --mode letters --rounds 5 --time 20
# Play expert mode
deno task start play --mode phrases --rounds 10 --time 45
```
Options:
- `-m, --mode <mode>` - Game mode: `letters`, `numbers`, `words`, or `phrases` (default: letters)
- `-r, --rounds <number>` - Number of rounds (default: 10)
- `-t, --time <seconds>` - Seconds per round (default: 30)
### View Statistics
```bash
deno task start stats
```
### Show Reference
Display a morse code reference chart:
```bash
deno task start reference
```
### Reset Statistics
```bash
deno task start reset
```
## How to Play
1. **Select a difficulty mode** - Choose from letters, numbers, words, or phrases
2. **Configure your game** - Set the number of rounds and time per round
3. **Translate to morse code** - You'll be shown a challenge (letter, number, word, or phrase)
4. **Enter your answer** - Type the morse code using:
- `.` (dot) for short signals
- `-` (dash) for long signals
- Space to separate letters
- `/` to separate words
5. **Get instant feedback** - See if you got it right and track your streak
6. **Review your performance** - After all rounds, view detailed statistics
## Morse Code Basics
- Use `.` for dots and `-` for dashes
- Separate letters with spaces
- Use `/` for word boundaries
- Example: `HELLO` = `.... . .-.. .-.. ---`
- Example: `SOS` = `... --- ...`
## Statistics
The game tracks:
- Total games played
- Total rounds completed
- Correct and incorrect answers
- Overall accuracy percentage
- Average time per round
- Best streak (consecutive correct answers)
- Per-mode statistics
Stats are saved to `~/.morse-game/stats.json`
## Development
```bash
# Run in watch mode for development
deno task dev
# Run with specific permissions
deno run --allow-read --allow-write --allow-env main.ts
```
## Project Structure
```
morse-game/
├── main.ts # CLI entry point and command parser
├── game.ts # Game logic and session management
├── morse.ts # Morse code translation utilities
├── stats.ts # Statistics tracking and persistence
├── ui.ts # TUI interface and menus
├── deno.json # Deno configuration and dependencies
└── README.md # This file
```
## Dependencies
- [@cliffy/command](https://jsr.io/@cliffy/command) - CLI framework
- [@cliffy/prompt](https://jsr.io/@cliffy/prompt) - Interactive prompts
- [@cliffy/ansi](https://jsr.io/@cliffy/ansi) - ANSI colors and formatting
- [@cliffy/table](https://jsr.io/@cliffy/table) - Table rendering
- [@std/path](https://jsr.io/@std/path) - Path utilities
- [@std/fs](https://jsr.io/@std/fs) - File system utilities
## License
MIT
## Contributing
Feel free to open issues or submit pull requests!
---
**73** (Best regards in morse code) 📡