Skip to content

Ivanlaguna511/ElDrowGame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ElDrowGame (Reverse Wordle Solver)

Java Terminal AI


About the Project

ElDrowGame ("Wordle" spelled backwards) is a terminal-based logic puzzle and AI-guessing game. It was developed as a practical assignment for the Programming Fundamentals course (First quarter, 1st Year of Computer Engineering).

Unlike the classic Wordle where the player guesses a word, ElDrow reverses the roles: the player thinks of a secret 5-letter word, and the computer's AI attempts to guess it in 6 tries or less by dynamically filtering a local dictionary based on the player's numerical feedback.

To prevent unfair play, the algorithm features an integrated Cheat Detection System that tracks the player's inputs and mathematically proves if a given clue was a lie.

Gameplay Mechanics

ElDrowGame Gameplay For every guess the computer makes, the player must provide a 5-digit feedback string:

  • 2: The letter is correct and in the right position (Green).
  • 1: The letter is in the word but in the wrong position (Yellow).
  • 0: The letter is not in the word (Gray).

If the computer runs out of attempts, it asks the user to dynamically add their secret word to its lista.txt dictionary, effectively "learning" for future games.


Tech Stack & Technical Features

  • Language: Java 8+
  • Interface: Command-Line Interface (CLI)
  • Data Persistence: File I/O (lista.txt for dictionary, puntuaciones.txt for score tracking).

Key Implementation Details

  • Dynamic Search Algorithm: Implements a multi-pass filtering engine that aggressively prunes the array of possible words based on positive (2), misplaced (1), and negative (0) constraints.
  • Cheat Detection Engine: The game silently computes the true feedback behind the scenes and compares it against the user's manual input. If a discrepancy is found, it logs the attempt and claims a default victory.
  • I/O & Memory Optimization: Uses Java Collections (LinkedHashSet) to instantly read, de-duplicate, and write back the active dictionary upon startup in O(N) time complexity, removing the need for nested loop comparisons.
  • Robust Regex Parsing: Complete console input validation using Regular Expressions (^[0-2]{5}$ and ^[A-Z]{5}$) to handle boundaries and prevent application crashes.

⚙️ How to Run Locally

Note: The game requires the lista.txt file to be located in the root directory alongside the executable to load the dictionary properly.

1. Clone the repository:

git clone [https://github.com/Ivanlaguna511/ElDrowGame.git](https://github.com/Ivanlaguna511/ElDrowGame.git)
cd ElDrowGame

2. Compile the Java file:

javac ElDrowGame.java

3. Run the application:

java ElDrowGame

Original Authors

-Iván Moro Cienfuegos and Daniel Viñas Vega

About

A Reverse Wordle AI solver built in Java. The algorithm filters a dynamic dictionary to guess the player's secret word. 1st-year University Project

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages