react-wordle
react-wordle copied to clipboard
Add debug option to show solution
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.
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
Your comments please @gheja @TheKnowles @cwackerfuss.
+1 This would be a useful feature.
Can .env be hot reloaded or do you have to bring the server down/up again?
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.
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
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?
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.
I think this is ready to go -- is this intended to still be in draft mode @igitur ?
@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.