Spaces:
Sleeping
Sleeping
Fix bug in updating the state based on a mask, in update_with_mask function
Browse files- wordle_env/state.py +6 -11
wordle_env/state.py
CHANGED
@@ -77,17 +77,12 @@ def update_from_mask(state: WordleState, word: str, mask: List[int]) -> WordleSt
|
|
77 |
_set_no(state, offset, i)
|
78 |
_set_if_cero(state, offset, [0, 1, 0])
|
79 |
elif mask[i] == NO:
|
80 |
-
# Need to check this first in case there's prior maybe
|
81 |
-
if c in prior_maybe:
|
82 |
-
#
|
83 |
-
state
|
84 |
-
|
85 |
-
|
86 |
-
# so it's zero everywhere except the yesses
|
87 |
-
for j in range(WORDLE_N):
|
88 |
-
# Only flip no if previously was maybe
|
89 |
-
if state[offset + 3 * j : offset + 3 * j + 3][1] == 1:
|
90 |
-
state[offset + 3 * j : offset + 3 * j + 3] = [1, 0, 0]
|
91 |
else:
|
92 |
# Just straight up no
|
93 |
_set_all_no(state, offset)
|
|
|
77 |
_set_no(state, offset, i)
|
78 |
_set_if_cero(state, offset, [0, 1, 0])
|
79 |
elif mask[i] == NO:
|
80 |
+
# Need to check this first in case there's prior maybe or yes
|
81 |
+
if c in prior_yes or c in prior_maybe:
|
82 |
+
# Definitely not here
|
83 |
+
_set_no(state, offset, i)
|
84 |
+
# It's zero everywhere except the yesses and maybes
|
85 |
+
_set_if_cero(state, offset, [1, 0, 0])
|
|
|
|
|
|
|
|
|
|
|
86 |
else:
|
87 |
# Just straight up no
|
88 |
_set_all_no(state, offset)
|