Spaces:
Build error
Build error
Fix bug in state update with mask
Browse filesFix import in wordle game simulator
Files changed (2)
61 unmodified lines6263646566676810 unmodified lines7980818283848586878 unmodified lines9697989910010110261 unmodified linesfor i, c in enumerate(word):cint = ord(c) - ord(WORDLE_CHARS[0])offset = 1 + cint * WORDLE_N * 3state[1 + cint] = 1if mask[i] == YES:prior_yes.append(c)# char at position i = yes, all other chars at position i == no10 unmodified linesprior_maybe.append(c)# Char at position i = no, and in other positions maybe except it had a value before, other chars stay as they arefor char_idx in range(0, WORDLE_N * 3, 3):char_offset = offset + char_idxif tuple(state[char_offset: char_offset + 3]) == (0, 0, 0):state[char_offset: char_offset + 3] = [0, 1, 0]state[offset + 3 * i:offset + 3 * i + 3] = [1, 0, 0]elif mask[i] == NO:# Need to check this first in case there's prior maybe + yes8 unmodified linesstate[offset + 3 * j:offset + 3 * j + 3] = [1, 0, 0]else:# Just straight up nostate[offset:offset+3*WORDLE_N] = [1, 0, 0]*WORDLE_Nreturn state61 unmodified lines62636465666710 unmodified lines7879808182838485868 unmodified lines959697989910010161 unmodified linesfor i, c in enumerate(word):cint = ord(c) - ord(WORDLE_CHARS[0])offset = 1 + cint * WORDLE_N * 3if mask[i] == YES:prior_yes.append(c)# char at position i = yes, all other chars at position i == no10 unmodified linesprior_maybe.append(c)# Char at position i = no, and in other positions maybe except it had a value before, other chars stay as they arefor char_idx in range(0, WORDLE_N * 3, 3):char_offset = offset + char_idxif tuple(state[char_offset: char_offset + 3]) == (0, 0, 0):state[char_offset: char_offset + 3] = [0, 1, 0]state[offset + 3 * i:offset + 3 * i + 3] = [1, 0, 0]elif mask[i] == NO:# Need to check this first in case there's prior maybe + yes8 unmodified linesstate[offset + 3 * j:offset + 3 * j + 3] = [1, 0, 0]else:# Just straight up nostate[offset:offset + 3 * WORDLE_N] = [1, 0, 0] * WORDLE_Nreturn state
1234567from rich.prompt import Promptfrom rich.console import Consolefrom random import choicefrom words import target_vocabulary, complete_vocabularySQUARES = {'correct_place': '🟩',1234567from rich.prompt import Promptfrom rich.console import Consolefrom random import choicefrom wordle_env.words import target_vocabulary, complete_vocabularySQUARES = {'correct_place': '🟩',
wordle_env/state.py+4-5
wordle_game.py+1-1