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.
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.
- Language: Java 8+
- Interface: Command-Line Interface (CLI)
- Data Persistence: File I/O (
lista.txtfor dictionary,puntuaciones.txtfor score tracking).
- 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.
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 ElDrowGame2. Compile the Java file:
javac ElDrowGame.java3. Run the application:
java ElDrowGame-Iván Moro Cienfuegos and Daniel Viñas Vega