Drawing inspiration from NY Times popular game wordle nywordle, this Wordle clone is a word-based guessing game developed using the Pygame library, featuring five interactive windows: rules, menu, options, game board, and result. The game lets users select difficulty levels, enter guesses, and receive feedback on their guesses through colored indicators. The game includes easy, medium, and hard difficulty levels with word sets for each.
The aim of this project is to create a Wordle clone using the Pygame library that consists of five windows:
- Rules – Displays the game instructions.
- Menu – Allows the user to play a new game or select the difficulty level.
- Options – Lets the user choose a difficulty level.
- Game Board – Where users can enter guesses.
- Result – Displays the game result (win or lose).
This game uses Pygame's modules like display, mouse, draw, font, image, and event, along with the sleep function from the time module.
-
Five Interactive Windows:
- Rules: Shows the game instructions loaded from a text file.
- Menu: Offers options to start a new game, choose difficulty, or exit.
- Options: Allows the selection of difficulty level (easy, medium, hard).
- Game Board: Displays tiles for guessing and allows input through a virtual keyboard.
- Result: Displays the outcome of the game (win/loss).
-
Dynamic Word Selection: Words are randomly selected from predefined text files based on the chosen difficulty level.
-
Feedback on Guesses: Color-coded tiles (green, yellow, gray) to indicate correct, misplaced, or incorrect letters.
- Pygame: Used for the graphical interface, including handling display, mouse clicks, drawing, fonts, images, and events.
- Time Module: Used for the sleep function to control the game's flow and timing.
- Rules Window: Displays the rules by importing
Rules.txt. - Menu Window: Allows the user to start a new game, choose options, or exit.
- Options Window: Lets the user select the difficulty level by clicking on the easy, medium, or hard options.
- Game Board: Displays the word tiles where the user enters guesses and shows feedback on the guesses.
- Result Window: Displays whether the user has won or lost and offers options to play again or exit the game.
- Text Files:
Easy.txt: Contains words for the easy difficulty level.Medium.txt: Contains words for the medium difficulty level.Hard.txt: Contains words for the hard difficulty level.Rules.txt: Contains the rules for the game, displayed in the rules window.
- rules(): Initializes the rules window, loads the rules from
Rules.txt, and displays the continue button. - click_rules(): Handles mouse hover and click events for the continue button in the rules window.
- menu(): Displays the menu window with options to start a new game, choose difficulty, or exit.
- click_newgame(): Handles mouse events for the new game, options, and exit buttons in the menu.
- words(): Displays difficulty options (easy, medium, hard).
- word_click(): Randomly selects a word from the respective difficulty file when a difficulty is chosen.
- game_board(): Displays the game board with word tiles.
- add_letter(): Renders and displays the entered letter in the corresponding tile.
- colour(): Provides feedback by coloring tiles based on the guessed letters.
- indicator(): Draws indicators (similar to a virtual keyboard) at the bottom of the screen.
- indicator_color(): Colors the indicators based on guessed letters' accuracy.
- result(): Displays the result of the game (win/lose) and provides options to play again or exit.
- reset_button(): Handles reset or exit after the result is displayed.
- delete(): Clears letters from the screen when necessary.
- quit(): Exits the Pygame window.
- Python 3.x with the Pygame library installed.
- IDEs like PyCharm, VS Code, or Jupyter Notebook for development.


