react-wordle icon indicating copy to clipboard operation
react-wordle copied to clipboard

Add debug option to show solution

Open igitur opened this issue 3 years ago • 9 comments

While reviewing PRs and debugging issues, I often need to know the answer upfront. I know I can get it by inspecting local storage, but that's effort.

This PR (still work in progress) adds support for an environment variable to optionally show the solution above the grid.

igitur avatar Mar 04 '22 10:03 igitur

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/cwackerfuss/react-wordle/3vq9ZtFGdxUL1b8v7bBbFN8F6maE
✅ Preview: https://react-wordle-git-fork-igitur-show-solution-d-3f319c-cwackerfuss.vercel.app

vercel[bot] avatar Mar 04 '22 10:03 vercel[bot]

Your comments please @gheja @TheKnowles @cwackerfuss.

igitur avatar Mar 04 '22 10:03 igitur

+1 This would be a useful feature.

Can .env be hot reloaded or do you have to bring the server down/up again?

TheKnowles avatar Mar 04 '22 14:03 TheKnowles

Maybe the best option would be to have a "cheats enabled" flag in .env that would only add a button on the navbar that pops up a modal like Settings but with debug/cheat options like this.

With this approach the option would not alter the gameplay but we would have the tools ready.

gheja avatar Mar 05 '22 14:03 gheja

Can .env be hot reloaded or do you have to bring the server down/up again?

Not sure about .env, will check, but you can hot reload by setting export const DEBUG_SHOW_SOLUTION = true in settings.ts

igitur avatar Mar 07 '22 12:03 igitur

Maybe the best option would be to have a "cheats enabled" flag in .env that would only add a button on the navbar that pops up a modal like Settings but with debug/cheat options like this.

With this approach the option would not alter the gameplay but we would have the tools ready.

That's an elegant solution, but my goal is to minimise the number of clicks to see the solution. And besides seeing the solution, what other kinds of cheats would you enable?

Do you mind if we park your suggestion for a follow-up PR?

igitur avatar Mar 08 '22 13:03 igitur

my goal is to minimise the number of clicks to see the solution

In that case a dedicated button would be the best. I suggested the extra modal to have the debug version as close as possible to prod version.

what other kinds of cheats would you enable?

I am not sure yet. Maybe a "clear local storage" or a "pick a new word to guess", I'm not sure, anything that helps the development or bug hunting but not part of the game. If there's a way to decide during build time to exclude the debug parts altogether, that would be useful too, and we'd have only one or two big chunks of debug code instead of scattered through the code.

gheja avatar Mar 12 '22 10:03 gheja

I think this is ready to go -- is this intended to still be in draft mode @igitur ?

cwackerfuss avatar Apr 22 '22 19:04 cwackerfuss

@cwackerfuss Welcome back!

Yes, still meant to be in draft mode. I want to incorporate the feedback. I just kind of forgot about this PR.

igitur avatar Apr 22 '22 21:04 igitur