Spaces:
Sleeping
Sleeping
Add some comments
Browse files- wordle_env/state.py +4 -0
wordle_env/state.py
CHANGED
@@ -164,6 +164,8 @@ def update(state: WordleState, word: str, goal_word: str) -> Tuple[WordleState,
|
|
164 |
|
165 |
|
166 |
def _set_if_cero(state, offset, value):
|
|
|
|
|
167 |
for char_idx in range(0, WORDLE_N * 3, 3):
|
168 |
char_offset = offset + char_idx
|
169 |
if tuple(state[char_offset: char_offset + 3]) == (0, 0, 0):
|
@@ -181,8 +183,10 @@ def _set_yes(state, offset, char_int, char_pos):
|
|
181 |
|
182 |
|
183 |
def _set_no(state, offset, char_pos):
|
|
|
184 |
state[offset + 3 * char_pos:offset + 3 * char_pos + 3] = [1, 0, 0]
|
185 |
|
186 |
|
187 |
def _set_all_no(state, offset):
|
|
|
188 |
state[offset:offset + 3 * WORDLE_N] = [1, 0, 0] * WORDLE_N
|
|
|
164 |
|
165 |
|
166 |
def _set_if_cero(state, offset, value):
|
167 |
+
# set offset character with value at all positions
|
168 |
+
# but only if it didnt have a value before
|
169 |
for char_idx in range(0, WORDLE_N * 3, 3):
|
170 |
char_offset = offset + char_idx
|
171 |
if tuple(state[char_offset: char_offset + 3]) == (0, 0, 0):
|
|
|
183 |
|
184 |
|
185 |
def _set_no(state, offset, char_pos):
|
186 |
+
# Set offset character = no at char_pos position
|
187 |
state[offset + 3 * char_pos:offset + 3 * char_pos + 3] = [1, 0, 0]
|
188 |
|
189 |
|
190 |
def _set_all_no(state, offset):
|
191 |
+
# Set offset character = no at all positions
|
192 |
state[offset:offset + 3 * WORDLE_N] = [1, 0, 0] * WORDLE_N
|