Hacker News new | ask | show | jobs
by nanis 1610 days ago
My cheat script will not help with refactoring your code, but note that with a helper data structure, you do not need multiple passes over the guess to mark each letter in one of three states. Write down the process in human language first, then write the code to do the thing instead of immediately diving into the code and rearranging it until it produces the desired result.

These exercises are great at improving your intuition and aptitude for refactoring code in a way that makes it more maintainable, easier to read and reason about.