Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled Case - New Guess on Keyboard #4

Open
mikeroher opened this issue Feb 27, 2022 · 0 comments
Open

Unhandled Case - New Guess on Keyboard #4

mikeroher opened this issue Feb 27, 2022 · 0 comments

Comments

@mikeroher
Copy link

mikeroher commented Feb 27, 2022

Hi Alan,

Since the current guess is appended to the usedKeys, I think there needs to be another case in the getKeyColors function to handle the empty variant. Without this case, I see a missing case error in the pattern match due to the tile conditional not matching the empty variant.

https://github.com/alanrsoares/weirdle/blob/main/src/components/Keyboard.tsx#L59

Here's one way to solve the issue:

if (key in usedKeys) {
        const tiles = usedKeys[key];
        const isBeingGuessed = tiles.every(
          propEq("variant", "empty")
        );
        if (isBeingGuessed) {
          return {};
        }

       const tile = ...

Thanks,
Mike

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant