2025-11-21 14:01:15 +01:00
2025-11-21 14:01:15 +01:00
2025-11-21 14:01:15 +01:00
2025-11-21 14:01:15 +01:00
2025-11-21 14:01:15 +01:00
2025-11-21 14:01:15 +01:00
2025-11-21 14:01:15 +01:00
2025-11-21 14:01:15 +01:00
2025-11-21 14:01:15 +01:00

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 installed.

# 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:

deno task start
# or
deno run --allow-read --allow-write --allow-env main.ts

Quick Play Mode

Start a game directly with custom settings:

# 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

deno task start stats

Show Reference

Display a morse code reference chart:

deno task start reference

Reset Statistics

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

# 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

License

MIT

Contributing

Feel free to open issues or submit pull requests!


73 (Best regards in morse code) 📡

Description
No description provided
Readme 90 KiB
Languages
TypeScript 100%