| 21 | self.word_list = ast.literal_eval(word_string) |
| 22 | |
| 23 | def modify_word_list(self, word, letter_status): |
| 24 | new_word_list = [] |
| 25 | correct_letters = [] |
| 26 | present_letters = [] |
| 27 | for i in range(len(word)): |
| 28 | if letter_status[i] == "correct": |
| 29 | correct_letters.append(word[i]) |
| 30 | for w in self.word_list: |
| 31 | if w[i] == word[i]: |
| 32 | new_word_list.append(w) |
| 33 | self.word_list = new_word_list |
| 34 | new_word_list = [] |
| 35 | for i in range(len(word)): |
| 36 | if letter_status[i] == "present": |
| 37 | present_letters.append(word[i]) |
| 38 | for w in self.word_list: |
| 39 | if word[i] in w and word[i] != w[i]: |
| 40 | new_word_list.append(w) |
| 41 | self.word_list = new_word_list |
| 42 | new_word_list = [] |
| 43 | for i in range(len(word)): |
| 44 | if letter_status[i] == "absent": |
| 45 | if ( |
| 46 | word[i] not in correct_letters |
| 47 | and word[i] not in present_letters |
| 48 | ): |
| 49 | for w in self.word_list: |
| 50 | if word[i] not in w: |
| 51 | new_word_list.append(w) |
| 52 | else: |
| 53 | for w in self.word_list: |
| 54 | if word[i] != w[i]: |
| 55 | new_word_list.append(w) |
| 56 | self.word_list = new_word_list |
| 57 | new_word_list = [] |
| 58 | |
| 59 | def skip_if_incorrect_env(self): |
| 60 | if self.headless: |