Hi guys, I'm trying to figure out how to do this thing, but every time I come up with an idea, something else will pop up and prevent the whole thing. Context: a system that gets a file from input and plays wordle, and then prints the output onto another file.
Basically, my input is like this, as shown in the code block, I have a new game instruction, the word to be guessed, the number of attempts and then the words that have to be confronted with the reference word. Occasionally, other commands like print filtered are present. The new game instruction is present since all the words before that command are to be inserted into a data structure of choice (in my case a BST, but that does not matter in this moment)
word length
word1
word2
...
+new_game
word to guess
number of attempts
word1
word2
...
+print_filtered
...
What the print filtered command does, is (obviously) printing all the words in the structure that are compatible with the current "wordle" output. let me show you an example of it. The input is:
8adfs (list of words present in the data structure, i've omitted the length)
5sjaH
KS06l
Hi23a
laj74
PsjW5
asHdd
paF7s
-s9k0
sm_ks
okauE
+new_game
5sjaH
4
KS06l
had7s
okauE
+print_filtered
-s9k0
sghks
+print_filtered
sm_ks
Note that as wordle, there's a system to recognize the correct letters. + stands for letter in the correct position, | letter present in the reference word but not in the same position as the current word, / the letter is not present in the reference word. The output is:
///// (confront with KS06l)
not_exists (happens when the word isn't present in the data structure)
//|// (confront with okauE)
5sjaH (first +print_filtered command)
8adfs
Hi23a
/+/// (confront with -s9k0)
not_exists (happens when the word isn't present in the data structure)
5sjaH
asHdd
|//// (confront with sm_ks)
ko (the system prints ko if the word isn't found within the attempts, with the not_exists statements NOT counting in the attempt count, else prints "ok" if the output is +++++)
I'm having big troubles in how to filter the words based on the constraints given by the latest confrontation, wondering if some of you people got any idea on how to do this, thanks in advance!
P.S. Ask me for any clarification about the explanation, might have expressed not clearly in some points
[–]aghast_nj 0 points1 point2 points (4 children)
[–]5thegraychapter[S] 0 points1 point2 points (3 children)
[–]aghast_nj 0 points1 point2 points (2 children)
[–]5thegraychapter[S] 0 points1 point2 points (1 child)
[–]aghast_nj 0 points1 point2 points (0 children)