Skip to main content

A Wordle-style word guessing game with Pygame UI

Project description

Words Guessing Game - Pygame UI Version

A Wordle-style word guessing game with a graphical user interface built using Pygame.

Features

  • Wordle-inspired visual design with color-coded feedback
  • Dual input system: Use physical keyboard or on-screen virtual keyboard
  • Customizable difficulty: Choose attempts (1-10) and word length (3-11)
  • Color-coded feedback:
    • 🟩 Green: Letter in correct position
    • 🟨 Yellow: Letter in word but wrong position
    • ⬜ Gray: Letter not in word
  • Virtual keyboard tracking: See which letters you've tried and their status

Requirements

  • Python 3.7+
  • pygame
  • nltk (already installed for the console version)

Installation

If pygame is not installed, run:

pip install pygame

How to Run

Pygame UI Version (NEW):

python game_with_ui.py

Original Console Version:

python start_game.py

How to Play

  1. Setup Screen:

    • Select the number of attempts (1-10)
    • Select word length (3-11 characters)
    • Click "START GAME"
  2. Game Screen:

    • Type your guess using your keyboard OR click letters on the virtual keyboard
    • Press ENTER or click "SUBMIT" to submit your guess
    • Watch the color-coded feedback:
      • Green tiles: Correct letter in correct position
      • Yellow tiles: Correct letter in wrong position
      • Gray tiles: Letter not in the word
    • Press ESC to restart the game
  3. End Screen:

    • See your final result (Win or Lose)
    • View the correct word
    • Click "PLAY AGAIN" to start a new game
    • Click "EXIT" to quit

Game Rules

  • Words must be exactly the length you selected
  • Words must contain only English letters (A-Z)
  • Words must be in the English dictionary
  • You have a limited number of attempts based on your selection

Controls

Physical Keyboard:

  • A-Z: Type letters
  • BACKSPACE: Delete last letter
  • ENTER: Submit guess
  • ESC: Return to setup screen

Mouse:

  • Click on virtual keyboard letters
  • Click "SUBMIT" button to submit guess
  • Click "←" button to delete last letter

File Structure

FirstGame/
├── game_with_ui.py          # Main pygame entry point (NEW)
├── start_game.py            # Original console version
├── ui/                      # UI components (NEW)
│   ├── __init__.py
│   ├── constants.py         # Colors, dimensions, fonts
│   ├── ui_components.py     # Reusable UI components
│   ├── setup_screen.py      # Setup screen
│   ├── game_screen.py       # Main game screen
│   └── end_screen.py        # Win/loss screen
└── functions/               # Game logic (unchanged)
    ├── find.py
    ├── print.py
    ├── validation.py
    ├── UserInputIntReader.py
    └── nltk_functions.py

Technical Notes

  • The pygame UI reuses all existing game logic from the functions/ directory
  • The original console version (start_game.py) remains fully functional
  • NLTK word dictionary will download automatically on first run (if not already cached)
  • Screen size: 600x800 pixels
  • FPS: 60

Tips

  • Start with easier settings (6 attempts, 5-letter words) to get familiar with the game
  • Watch the virtual keyboard to track which letters you've already tried
  • Common letters like E, A, R, I, O, T are good starting guesses

Troubleshooting

Issue: Game window doesn't open

  • Make sure pygame is installed: pip install pygame
  • Check that your Python version is 3.7 or higher

Issue: "Word not in dictionary" error for common words

  • The game uses NLTK's English word corpus
  • Make sure NLTK data is downloaded (happens automatically on first run)

Issue: Slow performance

  • Try reducing word length or attempts if on older hardware
  • The game runs at 60 FPS on most modern systems

Credits

Created using:

  • Pygame: Game framework
  • NLTK: English word dictionary
  • Inspired by Wordle

Enjoy the game!

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

words_guessing_game_banbar1-0.0.2.tar.gz (47.5 kB view details)

Uploaded Source

Built Distribution

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

words_guessing_game_banbar1-0.0.2-py3-none-any.whl (47.9 kB view details)

Uploaded Python 3

File details

Details for the file words_guessing_game_banbar1-0.0.2.tar.gz.

File metadata

File hashes

Hashes for words_guessing_game_banbar1-0.0.2.tar.gz
Algorithm Hash digest
SHA256 125b89c9e28167e8ef4540e0eb9df5785d439322417b7dcfcbb16a0734ff6b73
MD5 fc373ec7bea16f074c22f70743c32b60
BLAKE2b-256 722f2c06563507fe8fb736f040347eb9703ce7996ede5234bc8c7d1052878627

See more details on using hashes here.

File details

Details for the file words_guessing_game_banbar1-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for words_guessing_game_banbar1-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 857c0907574fbc7da6c596315ea8e50c3e4ae3b6f4c1d50e1660dffb0e00b731
MD5 557bad73b348a31ec3ddf84ed2eee9ae
BLAKE2b-256 4621191da5e06e4a34cece2b1dc583234d24fa36fa2a4c35c72482b2baca883d

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